// 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 query import ( "context" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gen" "gorm.io/gen/field" "gorm.io/plugin/dbresolver" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model" ) func newAppAccount(db *gorm.DB, opts ...gen.DOOption) appAccount { _appAccount := appAccount{} _appAccount.appAccountDo.UseDB(db, opts...) _appAccount.appAccountDo.UseModel(&model.AppAccount{}) tableName := _appAccount.appAccountDo.TableName() _appAccount.ALL = field.NewAsterisk(tableName) _appAccount.ID = field.NewUint32(tableName, "id") _appAccount.Type = field.NewUint32(tableName, "type") _appAccount.AppID = field.NewString(tableName, "app_id") _appAccount.Secret = field.NewString(tableName, "secret") _appAccount.Remark = field.NewString(tableName, "remark") _appAccount.DeletedAt = field.NewField(tableName, "deleted_at") _appAccount.fillFieldMap() return _appAccount } type appAccount struct { appAccountDo appAccountDo ALL field.Asterisk ID field.Uint32 Type field.Uint32 // 类型(0:抖音,1:微信) AppID field.String Secret field.String Remark field.String // 备注 DeletedAt field.Field fieldMap map[string]field.Expr } func (a appAccount) Table(newTableName string) *appAccount { a.appAccountDo.UseTable(newTableName) return a.updateTableName(newTableName) } func (a appAccount) As(alias string) *appAccount { a.appAccountDo.DO = *(a.appAccountDo.As(alias).(*gen.DO)) return a.updateTableName(alias) } func (a *appAccount) updateTableName(table string) *appAccount { a.ALL = field.NewAsterisk(table) a.ID = field.NewUint32(table, "id") a.Type = field.NewUint32(table, "type") a.AppID = field.NewString(table, "app_id") a.Secret = field.NewString(table, "secret") a.Remark = field.NewString(table, "remark") a.DeletedAt = field.NewField(table, "deleted_at") a.fillFieldMap() return a } func (a *appAccount) WithContext(ctx context.Context) *appAccountDo { return a.appAccountDo.WithContext(ctx) } func (a appAccount) TableName() string { return a.appAccountDo.TableName() } func (a appAccount) Alias() string { return a.appAccountDo.Alias() } func (a appAccount) Columns(cols ...field.Expr) gen.Columns { return a.appAccountDo.Columns(cols...) } func (a *appAccount) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := a.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (a *appAccount) fillFieldMap() { a.fieldMap = make(map[string]field.Expr, 6) a.fieldMap["id"] = a.ID a.fieldMap["type"] = a.Type a.fieldMap["app_id"] = a.AppID a.fieldMap["secret"] = a.Secret a.fieldMap["remark"] = a.Remark a.fieldMap["deleted_at"] = a.DeletedAt } func (a appAccount) clone(db *gorm.DB) appAccount { a.appAccountDo.ReplaceConnPool(db.Statement.ConnPool) return a } func (a appAccount) replaceDB(db *gorm.DB) appAccount { a.appAccountDo.ReplaceDB(db) return a } type appAccountDo struct{ gen.DO } func (a appAccountDo) Debug() *appAccountDo { return a.withDO(a.DO.Debug()) } func (a appAccountDo) WithContext(ctx context.Context) *appAccountDo { return a.withDO(a.DO.WithContext(ctx)) } func (a appAccountDo) ReadDB() *appAccountDo { return a.Clauses(dbresolver.Read) } func (a appAccountDo) WriteDB() *appAccountDo { return a.Clauses(dbresolver.Write) } func (a appAccountDo) Session(config *gorm.Session) *appAccountDo { return a.withDO(a.DO.Session(config)) } func (a appAccountDo) Clauses(conds ...clause.Expression) *appAccountDo { return a.withDO(a.DO.Clauses(conds...)) } func (a appAccountDo) Returning(value interface{}, columns ...string) *appAccountDo { return a.withDO(a.DO.Returning(value, columns...)) } func (a appAccountDo) Not(conds ...gen.Condition) *appAccountDo { return a.withDO(a.DO.Not(conds...)) } func (a appAccountDo) Or(conds ...gen.Condition) *appAccountDo { return a.withDO(a.DO.Or(conds...)) } func (a appAccountDo) Select(conds ...field.Expr) *appAccountDo { return a.withDO(a.DO.Select(conds...)) } func (a appAccountDo) Where(conds ...gen.Condition) *appAccountDo { return a.withDO(a.DO.Where(conds...)) } func (a appAccountDo) Order(conds ...field.Expr) *appAccountDo { return a.withDO(a.DO.Order(conds...)) } func (a appAccountDo) Distinct(cols ...field.Expr) *appAccountDo { return a.withDO(a.DO.Distinct(cols...)) } func (a appAccountDo) Omit(cols ...field.Expr) *appAccountDo { return a.withDO(a.DO.Omit(cols...)) } func (a appAccountDo) Join(table schema.Tabler, on ...field.Expr) *appAccountDo { return a.withDO(a.DO.Join(table, on...)) } func (a appAccountDo) LeftJoin(table schema.Tabler, on ...field.Expr) *appAccountDo { return a.withDO(a.DO.LeftJoin(table, on...)) } func (a appAccountDo) RightJoin(table schema.Tabler, on ...field.Expr) *appAccountDo { return a.withDO(a.DO.RightJoin(table, on...)) } func (a appAccountDo) Group(cols ...field.Expr) *appAccountDo { return a.withDO(a.DO.Group(cols...)) } func (a appAccountDo) Having(conds ...gen.Condition) *appAccountDo { return a.withDO(a.DO.Having(conds...)) } func (a appAccountDo) Limit(limit int) *appAccountDo { return a.withDO(a.DO.Limit(limit)) } func (a appAccountDo) Offset(offset int) *appAccountDo { return a.withDO(a.DO.Offset(offset)) } func (a appAccountDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *appAccountDo { return a.withDO(a.DO.Scopes(funcs...)) } func (a appAccountDo) Unscoped() *appAccountDo { return a.withDO(a.DO.Unscoped()) } func (a appAccountDo) Create(values ...*model.AppAccount) error { if len(values) == 0 { return nil } return a.DO.Create(values) } func (a appAccountDo) CreateInBatches(values []*model.AppAccount, batchSize int) error { return a.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 (a appAccountDo) Save(values ...*model.AppAccount) error { if len(values) == 0 { return nil } return a.DO.Save(values) } func (a appAccountDo) First() (*model.AppAccount, error) { if result, err := a.DO.First(); err != nil { return nil, err } else { return result.(*model.AppAccount), nil } } func (a appAccountDo) Take() (*model.AppAccount, error) { if result, err := a.DO.Take(); err != nil { return nil, err } else { return result.(*model.AppAccount), nil } } func (a appAccountDo) Last() (*model.AppAccount, error) { if result, err := a.DO.Last(); err != nil { return nil, err } else { return result.(*model.AppAccount), nil } } func (a appAccountDo) Find() ([]*model.AppAccount, error) { result, err := a.DO.Find() return result.([]*model.AppAccount), err } func (a appAccountDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AppAccount, err error) { buf := make([]*model.AppAccount, 0, batchSize) err = a.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 (a appAccountDo) FindInBatches(result *[]*model.AppAccount, batchSize int, fc func(tx gen.Dao, batch int) error) error { return a.DO.FindInBatches(result, batchSize, fc) } func (a appAccountDo) Attrs(attrs ...field.AssignExpr) *appAccountDo { return a.withDO(a.DO.Attrs(attrs...)) } func (a appAccountDo) Assign(attrs ...field.AssignExpr) *appAccountDo { return a.withDO(a.DO.Assign(attrs...)) } func (a appAccountDo) Joins(fields ...field.RelationField) *appAccountDo { for _, _f := range fields { a = *a.withDO(a.DO.Joins(_f)) } return &a } func (a appAccountDo) Preload(fields ...field.RelationField) *appAccountDo { for _, _f := range fields { a = *a.withDO(a.DO.Preload(_f)) } return &a } func (a appAccountDo) FirstOrInit() (*model.AppAccount, error) { if result, err := a.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.AppAccount), nil } } func (a appAccountDo) FirstOrCreate() (*model.AppAccount, error) { if result, err := a.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.AppAccount), nil } } func (a appAccountDo) FindByPage(offset int, limit int) (result []*model.AppAccount, count int64, err error) { result, err = a.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 = a.Offset(-1).Limit(-1).Count() return } func (a appAccountDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = a.Count() if err != nil { return } err = a.Offset(offset).Limit(limit).Scan(result) return } func (a appAccountDo) Scan(result interface{}) (err error) { return a.DO.Scan(result) } func (a appAccountDo) Delete(models ...*model.AppAccount) (result gen.ResultInfo, err error) { return a.DO.Delete(models) } func (a *appAccountDo) withDO(do gen.Dao) *appAccountDo { a.DO = *do.(*gen.DO) return a }