Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 40s
feat(pay): 添加支付API基础结构 feat(miniapp): 创建支付测试小程序页面与配置 feat(wechatpay): 配置微信支付参数与证书 fix(guild): 修复成员列表查询条件 docs: 更新代码规范文档与需求文档 style: 统一前后端枚举显示与注释格式 refactor(admin): 重构用户奖励发放接口参数处理 test(title): 添加称号效果参数验证测试
344 lines
9.1 KiB
Go
344 lines
9.1 KiB
Go
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
|
|
package dao
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm/clause"
|
|
"gorm.io/gorm/schema"
|
|
|
|
"gorm.io/gen"
|
|
"gorm.io/gen/field"
|
|
|
|
"gorm.io/plugin/dbresolver"
|
|
|
|
"bindbox-game/internal/repository/mysql/model"
|
|
)
|
|
|
|
func newPaymentBills(db *gorm.DB, opts ...gen.DOOption) paymentBills {
|
|
_paymentBills := paymentBills{}
|
|
|
|
_paymentBills.paymentBillsDo.UseDB(db, opts...)
|
|
_paymentBills.paymentBillsDo.UseModel(&model.PaymentBills{})
|
|
|
|
tableName := _paymentBills.paymentBillsDo.TableName()
|
|
_paymentBills.ALL = field.NewAsterisk(tableName)
|
|
_paymentBills.ID = field.NewInt64(tableName, "id")
|
|
_paymentBills.BillDate = field.NewTime(tableName, "bill_date")
|
|
_paymentBills.Type = field.NewString(tableName, "type")
|
|
_paymentBills.FileURL = field.NewString(tableName, "file_url")
|
|
_paymentBills.Digest = field.NewString(tableName, "digest")
|
|
_paymentBills.Imported = field.NewBool(tableName, "imported")
|
|
_paymentBills.CreatedAt = field.NewTime(tableName, "created_at")
|
|
|
|
_paymentBills.fillFieldMap()
|
|
|
|
return _paymentBills
|
|
}
|
|
|
|
type paymentBills struct {
|
|
paymentBillsDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Int64
|
|
BillDate field.Time
|
|
Type field.String
|
|
FileURL field.String
|
|
Digest field.String
|
|
Imported field.Bool
|
|
CreatedAt field.Time
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (p paymentBills) Table(newTableName string) *paymentBills {
|
|
p.paymentBillsDo.UseTable(newTableName)
|
|
return p.updateTableName(newTableName)
|
|
}
|
|
|
|
func (p paymentBills) As(alias string) *paymentBills {
|
|
p.paymentBillsDo.DO = *(p.paymentBillsDo.As(alias).(*gen.DO))
|
|
return p.updateTableName(alias)
|
|
}
|
|
|
|
func (p *paymentBills) updateTableName(table string) *paymentBills {
|
|
p.ALL = field.NewAsterisk(table)
|
|
p.ID = field.NewInt64(table, "id")
|
|
p.BillDate = field.NewTime(table, "bill_date")
|
|
p.Type = field.NewString(table, "type")
|
|
p.FileURL = field.NewString(table, "file_url")
|
|
p.Digest = field.NewString(table, "digest")
|
|
p.Imported = field.NewBool(table, "imported")
|
|
p.CreatedAt = field.NewTime(table, "created_at")
|
|
|
|
p.fillFieldMap()
|
|
|
|
return p
|
|
}
|
|
|
|
func (p *paymentBills) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|
_f, ok := p.fieldMap[fieldName]
|
|
if !ok || _f == nil {
|
|
return nil, false
|
|
}
|
|
_oe, ok := _f.(field.OrderExpr)
|
|
return _oe, ok
|
|
}
|
|
|
|
func (p *paymentBills) fillFieldMap() {
|
|
p.fieldMap = make(map[string]field.Expr, 7)
|
|
p.fieldMap["id"] = p.ID
|
|
p.fieldMap["bill_date"] = p.BillDate
|
|
p.fieldMap["type"] = p.Type
|
|
p.fieldMap["file_url"] = p.FileURL
|
|
p.fieldMap["digest"] = p.Digest
|
|
p.fieldMap["imported"] = p.Imported
|
|
p.fieldMap["created_at"] = p.CreatedAt
|
|
}
|
|
|
|
func (p paymentBills) clone(db *gorm.DB) paymentBills {
|
|
p.paymentBillsDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return p
|
|
}
|
|
|
|
func (p paymentBills) replaceDB(db *gorm.DB) paymentBills {
|
|
p.paymentBillsDo.ReplaceDB(db)
|
|
return p
|
|
}
|
|
|
|
type paymentBillsDo struct{ gen.DO }
|
|
|
|
func (p paymentBillsDo) Debug() *paymentBillsDo {
|
|
return p.withDO(p.DO.Debug())
|
|
}
|
|
|
|
func (p paymentBillsDo) WithContext(ctx context.Context) *paymentBillsDo {
|
|
return p.withDO(p.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (p paymentBillsDo) ReadDB() *paymentBillsDo {
|
|
return p.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (p paymentBillsDo) WriteDB() *paymentBillsDo {
|
|
return p.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (p paymentBillsDo) Session(config *gorm.Session) *paymentBillsDo {
|
|
return p.withDO(p.DO.Session(config))
|
|
}
|
|
|
|
func (p paymentBillsDo) Clauses(conds ...clause.Expression) *paymentBillsDo {
|
|
return p.withDO(p.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Returning(value interface{}, columns ...string) *paymentBillsDo {
|
|
return p.withDO(p.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Not(conds ...gen.Condition) *paymentBillsDo {
|
|
return p.withDO(p.DO.Not(conds...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Or(conds ...gen.Condition) *paymentBillsDo {
|
|
return p.withDO(p.DO.Or(conds...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Select(conds ...field.Expr) *paymentBillsDo {
|
|
return p.withDO(p.DO.Select(conds...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Where(conds ...gen.Condition) *paymentBillsDo {
|
|
return p.withDO(p.DO.Where(conds...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Order(conds ...field.Expr) *paymentBillsDo {
|
|
return p.withDO(p.DO.Order(conds...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Distinct(cols ...field.Expr) *paymentBillsDo {
|
|
return p.withDO(p.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Omit(cols ...field.Expr) *paymentBillsDo {
|
|
return p.withDO(p.DO.Omit(cols...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Join(table schema.Tabler, on ...field.Expr) *paymentBillsDo {
|
|
return p.withDO(p.DO.Join(table, on...))
|
|
}
|
|
|
|
func (p paymentBillsDo) LeftJoin(table schema.Tabler, on ...field.Expr) *paymentBillsDo {
|
|
return p.withDO(p.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (p paymentBillsDo) RightJoin(table schema.Tabler, on ...field.Expr) *paymentBillsDo {
|
|
return p.withDO(p.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Group(cols ...field.Expr) *paymentBillsDo {
|
|
return p.withDO(p.DO.Group(cols...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Having(conds ...gen.Condition) *paymentBillsDo {
|
|
return p.withDO(p.DO.Having(conds...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Limit(limit int) *paymentBillsDo {
|
|
return p.withDO(p.DO.Limit(limit))
|
|
}
|
|
|
|
func (p paymentBillsDo) Offset(offset int) *paymentBillsDo {
|
|
return p.withDO(p.DO.Offset(offset))
|
|
}
|
|
|
|
func (p paymentBillsDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *paymentBillsDo {
|
|
return p.withDO(p.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Unscoped() *paymentBillsDo {
|
|
return p.withDO(p.DO.Unscoped())
|
|
}
|
|
|
|
func (p paymentBillsDo) Create(values ...*model.PaymentBills) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return p.DO.Create(values)
|
|
}
|
|
|
|
func (p paymentBillsDo) CreateInBatches(values []*model.PaymentBills, batchSize int) error {
|
|
return p.DO.CreateInBatches(values, batchSize)
|
|
}
|
|
|
|
// Save : !!! underlying implementation is different with GORM
|
|
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
|
func (p paymentBillsDo) Save(values ...*model.PaymentBills) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return p.DO.Save(values)
|
|
}
|
|
|
|
func (p paymentBillsDo) First() (*model.PaymentBills, error) {
|
|
if result, err := p.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.PaymentBills), nil
|
|
}
|
|
}
|
|
|
|
func (p paymentBillsDo) Take() (*model.PaymentBills, error) {
|
|
if result, err := p.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.PaymentBills), nil
|
|
}
|
|
}
|
|
|
|
func (p paymentBillsDo) Last() (*model.PaymentBills, error) {
|
|
if result, err := p.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.PaymentBills), nil
|
|
}
|
|
}
|
|
|
|
func (p paymentBillsDo) Find() ([]*model.PaymentBills, error) {
|
|
result, err := p.DO.Find()
|
|
return result.([]*model.PaymentBills), err
|
|
}
|
|
|
|
func (p paymentBillsDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.PaymentBills, err error) {
|
|
buf := make([]*model.PaymentBills, 0, batchSize)
|
|
err = p.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
|
defer func() { results = append(results, buf...) }()
|
|
return fc(tx, batch)
|
|
})
|
|
return results, err
|
|
}
|
|
|
|
func (p paymentBillsDo) FindInBatches(result *[]*model.PaymentBills, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return p.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (p paymentBillsDo) Attrs(attrs ...field.AssignExpr) *paymentBillsDo {
|
|
return p.withDO(p.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Assign(attrs ...field.AssignExpr) *paymentBillsDo {
|
|
return p.withDO(p.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (p paymentBillsDo) Joins(fields ...field.RelationField) *paymentBillsDo {
|
|
for _, _f := range fields {
|
|
p = *p.withDO(p.DO.Joins(_f))
|
|
}
|
|
return &p
|
|
}
|
|
|
|
func (p paymentBillsDo) Preload(fields ...field.RelationField) *paymentBillsDo {
|
|
for _, _f := range fields {
|
|
p = *p.withDO(p.DO.Preload(_f))
|
|
}
|
|
return &p
|
|
}
|
|
|
|
func (p paymentBillsDo) FirstOrInit() (*model.PaymentBills, error) {
|
|
if result, err := p.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.PaymentBills), nil
|
|
}
|
|
}
|
|
|
|
func (p paymentBillsDo) FirstOrCreate() (*model.PaymentBills, error) {
|
|
if result, err := p.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.PaymentBills), nil
|
|
}
|
|
}
|
|
|
|
func (p paymentBillsDo) FindByPage(offset int, limit int) (result []*model.PaymentBills, count int64, err error) {
|
|
result, err = p.Offset(offset).Limit(limit).Find()
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if size := len(result); 0 < limit && 0 < size && size < limit {
|
|
count = int64(size + offset)
|
|
return
|
|
}
|
|
|
|
count, err = p.Offset(-1).Limit(-1).Count()
|
|
return
|
|
}
|
|
|
|
func (p paymentBillsDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
|
count, err = p.Count()
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
err = p.Offset(offset).Limit(limit).Scan(result)
|
|
return
|
|
}
|
|
|
|
func (p paymentBillsDo) Scan(result interface{}) (err error) {
|
|
return p.DO.Scan(result)
|
|
}
|
|
|
|
func (p paymentBillsDo) Delete(models ...*model.PaymentBills) (result gen.ResultInfo, err error) {
|
|
return p.DO.Delete(models)
|
|
}
|
|
|
|
func (p *paymentBillsDo) withDO(do gen.Dao) *paymentBillsDo {
|
|
p.DO = *do.(*gen.DO)
|
|
return p
|
|
}
|