// 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" "joybuywork/internal/repository/model" ) func newFissionUserPreCond(db *gorm.DB, opts ...gen.DOOption) fissionUserPreCond { _fissionUserPreCond := fissionUserPreCond{} _fissionUserPreCond.fissionUserPreCondDo.UseDB(db, opts...) _fissionUserPreCond.fissionUserPreCondDo.UseModel(&model.FissionUserPreCond{}) tableName := _fissionUserPreCond.fissionUserPreCondDo.TableName() _fissionUserPreCond.ALL = field.NewAsterisk(tableName) _fissionUserPreCond.ID = field.NewInt64(tableName, "id") _fissionUserPreCond.CreatedAt = field.NewInt64(tableName, "created_at") _fissionUserPreCond.UpdatedAt = field.NewInt64(tableName, "updated_at") _fissionUserPreCond.CampaignID = field.NewInt64(tableName, "campaign_id") _fissionUserPreCond.UserID = field.NewInt64(tableName, "user_id") _fissionUserPreCond.PreCond = field.NewInt32(tableName, "pre_cond") _fissionUserPreCond.ExpiredAt = field.NewInt64(tableName, "expired_at") _fissionUserPreCond.fillFieldMap() return _fissionUserPreCond } type fissionUserPreCond struct { fissionUserPreCondDo fissionUserPreCondDo ALL field.Asterisk ID field.Int64 CreatedAt field.Int64 UpdatedAt field.Int64 CampaignID field.Int64 // 活动ID(fission_campaign表) UserID field.Int64 // 用户id PreCond field.Int32 // 完成的前置任务 ExpiredAt field.Int64 // 前置任务过期时间 fieldMap map[string]field.Expr } func (f fissionUserPreCond) Table(newTableName string) *fissionUserPreCond { f.fissionUserPreCondDo.UseTable(newTableName) return f.updateTableName(newTableName) } func (f fissionUserPreCond) As(alias string) *fissionUserPreCond { f.fissionUserPreCondDo.DO = *(f.fissionUserPreCondDo.As(alias).(*gen.DO)) return f.updateTableName(alias) } func (f *fissionUserPreCond) updateTableName(table string) *fissionUserPreCond { f.ALL = field.NewAsterisk(table) f.ID = field.NewInt64(table, "id") f.CreatedAt = field.NewInt64(table, "created_at") f.UpdatedAt = field.NewInt64(table, "updated_at") f.CampaignID = field.NewInt64(table, "campaign_id") f.UserID = field.NewInt64(table, "user_id") f.PreCond = field.NewInt32(table, "pre_cond") f.ExpiredAt = field.NewInt64(table, "expired_at") f.fillFieldMap() return f } func (f *fissionUserPreCond) WithContext(ctx context.Context) *fissionUserPreCondDo { return f.fissionUserPreCondDo.WithContext(ctx) } func (f fissionUserPreCond) TableName() string { return f.fissionUserPreCondDo.TableName() } func (f fissionUserPreCond) Alias() string { return f.fissionUserPreCondDo.Alias() } func (f *fissionUserPreCond) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := f.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (f *fissionUserPreCond) fillFieldMap() { f.fieldMap = make(map[string]field.Expr, 7) f.fieldMap["id"] = f.ID f.fieldMap["created_at"] = f.CreatedAt f.fieldMap["updated_at"] = f.UpdatedAt f.fieldMap["campaign_id"] = f.CampaignID f.fieldMap["user_id"] = f.UserID f.fieldMap["pre_cond"] = f.PreCond f.fieldMap["expired_at"] = f.ExpiredAt } func (f fissionUserPreCond) clone(db *gorm.DB) fissionUserPreCond { f.fissionUserPreCondDo.ReplaceConnPool(db.Statement.ConnPool) return f } func (f fissionUserPreCond) replaceDB(db *gorm.DB) fissionUserPreCond { f.fissionUserPreCondDo.ReplaceDB(db) return f } type fissionUserPreCondDo struct{ gen.DO } func (f fissionUserPreCondDo) Debug() *fissionUserPreCondDo { return f.withDO(f.DO.Debug()) } func (f fissionUserPreCondDo) WithContext(ctx context.Context) *fissionUserPreCondDo { return f.withDO(f.DO.WithContext(ctx)) } func (f fissionUserPreCondDo) ReadDB() *fissionUserPreCondDo { return f.Clauses(dbresolver.Read) } func (f fissionUserPreCondDo) WriteDB() *fissionUserPreCondDo { return f.Clauses(dbresolver.Write) } func (f fissionUserPreCondDo) Session(config *gorm.Session) *fissionUserPreCondDo { return f.withDO(f.DO.Session(config)) } func (f fissionUserPreCondDo) Clauses(conds ...clause.Expression) *fissionUserPreCondDo { return f.withDO(f.DO.Clauses(conds...)) } func (f fissionUserPreCondDo) Returning(value interface{}, columns ...string) *fissionUserPreCondDo { return f.withDO(f.DO.Returning(value, columns...)) } func (f fissionUserPreCondDo) Not(conds ...gen.Condition) *fissionUserPreCondDo { return f.withDO(f.DO.Not(conds...)) } func (f fissionUserPreCondDo) Or(conds ...gen.Condition) *fissionUserPreCondDo { return f.withDO(f.DO.Or(conds...)) } func (f fissionUserPreCondDo) Select(conds ...field.Expr) *fissionUserPreCondDo { return f.withDO(f.DO.Select(conds...)) } func (f fissionUserPreCondDo) Where(conds ...gen.Condition) *fissionUserPreCondDo { return f.withDO(f.DO.Where(conds...)) } func (f fissionUserPreCondDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *fissionUserPreCondDo { return f.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (f fissionUserPreCondDo) Order(conds ...field.Expr) *fissionUserPreCondDo { return f.withDO(f.DO.Order(conds...)) } func (f fissionUserPreCondDo) Distinct(cols ...field.Expr) *fissionUserPreCondDo { return f.withDO(f.DO.Distinct(cols...)) } func (f fissionUserPreCondDo) Omit(cols ...field.Expr) *fissionUserPreCondDo { return f.withDO(f.DO.Omit(cols...)) } func (f fissionUserPreCondDo) Join(table schema.Tabler, on ...field.Expr) *fissionUserPreCondDo { return f.withDO(f.DO.Join(table, on...)) } func (f fissionUserPreCondDo) LeftJoin(table schema.Tabler, on ...field.Expr) *fissionUserPreCondDo { return f.withDO(f.DO.LeftJoin(table, on...)) } func (f fissionUserPreCondDo) RightJoin(table schema.Tabler, on ...field.Expr) *fissionUserPreCondDo { return f.withDO(f.DO.RightJoin(table, on...)) } func (f fissionUserPreCondDo) Group(cols ...field.Expr) *fissionUserPreCondDo { return f.withDO(f.DO.Group(cols...)) } func (f fissionUserPreCondDo) Having(conds ...gen.Condition) *fissionUserPreCondDo { return f.withDO(f.DO.Having(conds...)) } func (f fissionUserPreCondDo) Limit(limit int) *fissionUserPreCondDo { return f.withDO(f.DO.Limit(limit)) } func (f fissionUserPreCondDo) Offset(offset int) *fissionUserPreCondDo { return f.withDO(f.DO.Offset(offset)) } func (f fissionUserPreCondDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *fissionUserPreCondDo { return f.withDO(f.DO.Scopes(funcs...)) } func (f fissionUserPreCondDo) Unscoped() *fissionUserPreCondDo { return f.withDO(f.DO.Unscoped()) } func (f fissionUserPreCondDo) Create(values ...*model.FissionUserPreCond) error { if len(values) == 0 { return nil } return f.DO.Create(values) } func (f fissionUserPreCondDo) CreateInBatches(values []*model.FissionUserPreCond, batchSize int) error { return f.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 (f fissionUserPreCondDo) Save(values ...*model.FissionUserPreCond) error { if len(values) == 0 { return nil } return f.DO.Save(values) } func (f fissionUserPreCondDo) First() (*model.FissionUserPreCond, error) { if result, err := f.DO.First(); err != nil { return nil, err } else { return result.(*model.FissionUserPreCond), nil } } func (f fissionUserPreCondDo) Take() (*model.FissionUserPreCond, error) { if result, err := f.DO.Take(); err != nil { return nil, err } else { return result.(*model.FissionUserPreCond), nil } } func (f fissionUserPreCondDo) Last() (*model.FissionUserPreCond, error) { if result, err := f.DO.Last(); err != nil { return nil, err } else { return result.(*model.FissionUserPreCond), nil } } func (f fissionUserPreCondDo) Find() ([]*model.FissionUserPreCond, error) { result, err := f.DO.Find() return result.([]*model.FissionUserPreCond), err } func (f fissionUserPreCondDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FissionUserPreCond, err error) { buf := make([]*model.FissionUserPreCond, 0, batchSize) err = f.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 (f fissionUserPreCondDo) FindInBatches(result *[]*model.FissionUserPreCond, batchSize int, fc func(tx gen.Dao, batch int) error) error { return f.DO.FindInBatches(result, batchSize, fc) } func (f fissionUserPreCondDo) Attrs(attrs ...field.AssignExpr) *fissionUserPreCondDo { return f.withDO(f.DO.Attrs(attrs...)) } func (f fissionUserPreCondDo) Assign(attrs ...field.AssignExpr) *fissionUserPreCondDo { return f.withDO(f.DO.Assign(attrs...)) } func (f fissionUserPreCondDo) Joins(fields ...field.RelationField) *fissionUserPreCondDo { for _, _f := range fields { f = *f.withDO(f.DO.Joins(_f)) } return &f } func (f fissionUserPreCondDo) Preload(fields ...field.RelationField) *fissionUserPreCondDo { for _, _f := range fields { f = *f.withDO(f.DO.Preload(_f)) } return &f } func (f fissionUserPreCondDo) FirstOrInit() (*model.FissionUserPreCond, error) { if result, err := f.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.FissionUserPreCond), nil } } func (f fissionUserPreCondDo) FirstOrCreate() (*model.FissionUserPreCond, error) { if result, err := f.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.FissionUserPreCond), nil } } func (f fissionUserPreCondDo) FindByPage(offset int, limit int) (result []*model.FissionUserPreCond, count int64, err error) { result, err = f.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 = f.Offset(-1).Limit(-1).Count() return } func (f fissionUserPreCondDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = f.Count() if err != nil { return } err = f.Offset(offset).Limit(limit).Scan(result) return } func (f fissionUserPreCondDo) Scan(result interface{}) (err error) { return f.DO.Scan(result) } func (f fissionUserPreCondDo) Delete(models ...*model.FissionUserPreCond) (result gen.ResultInfo, err error) { return f.DO.Delete(models) } func (f *fissionUserPreCondDo) withDO(do gen.Dao) *fissionUserPreCondDo { f.DO = *do.(*gen.DO) return f }