// 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 newProjectUserCoinExpired(db *gorm.DB, opts ...gen.DOOption) projectUserCoinExpired { _projectUserCoinExpired := projectUserCoinExpired{} _projectUserCoinExpired.projectUserCoinExpiredDo.UseDB(db, opts...) _projectUserCoinExpired.projectUserCoinExpiredDo.UseModel(&model.ProjectUserCoinExpired{}) tableName := _projectUserCoinExpired.projectUserCoinExpiredDo.TableName() _projectUserCoinExpired.ALL = field.NewAsterisk(tableName) _projectUserCoinExpired.ID = field.NewInt64(tableName, "id") _projectUserCoinExpired.CreatedAt = field.NewInt64(tableName, "created_at") _projectUserCoinExpired.UpdatedAt = field.NewInt64(tableName, "updated_at") _projectUserCoinExpired.UserID = field.NewInt64(tableName, "user_id") _projectUserCoinExpired.CoinID = field.NewInt64(tableName, "coin_id") _projectUserCoinExpired.DoneAt = field.NewInt64(tableName, "done_at") _projectUserCoinExpired.IsWait = field.NewInt8(tableName, "is_wait") _projectUserCoinExpired.fillFieldMap() return _projectUserCoinExpired } type projectUserCoinExpired struct { projectUserCoinExpiredDo projectUserCoinExpiredDo ALL field.Asterisk ID field.Int64 CreatedAt field.Int64 UpdatedAt field.Int64 UserID field.Int64 // 用户id CoinID field.Int64 // 积分id DoneAt field.Int64 // 执行时间 IsWait field.Int8 // 是否待执行 fieldMap map[string]field.Expr } func (p projectUserCoinExpired) Table(newTableName string) *projectUserCoinExpired { p.projectUserCoinExpiredDo.UseTable(newTableName) return p.updateTableName(newTableName) } func (p projectUserCoinExpired) As(alias string) *projectUserCoinExpired { p.projectUserCoinExpiredDo.DO = *(p.projectUserCoinExpiredDo.As(alias).(*gen.DO)) return p.updateTableName(alias) } func (p *projectUserCoinExpired) updateTableName(table string) *projectUserCoinExpired { p.ALL = field.NewAsterisk(table) p.ID = field.NewInt64(table, "id") p.CreatedAt = field.NewInt64(table, "created_at") p.UpdatedAt = field.NewInt64(table, "updated_at") p.UserID = field.NewInt64(table, "user_id") p.CoinID = field.NewInt64(table, "coin_id") p.DoneAt = field.NewInt64(table, "done_at") p.IsWait = field.NewInt8(table, "is_wait") p.fillFieldMap() return p } func (p *projectUserCoinExpired) WithContext(ctx context.Context) *projectUserCoinExpiredDo { return p.projectUserCoinExpiredDo.WithContext(ctx) } func (p projectUserCoinExpired) TableName() string { return p.projectUserCoinExpiredDo.TableName() } func (p projectUserCoinExpired) Alias() string { return p.projectUserCoinExpiredDo.Alias() } func (p *projectUserCoinExpired) 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 *projectUserCoinExpired) fillFieldMap() { p.fieldMap = make(map[string]field.Expr, 7) p.fieldMap["id"] = p.ID p.fieldMap["created_at"] = p.CreatedAt p.fieldMap["updated_at"] = p.UpdatedAt p.fieldMap["user_id"] = p.UserID p.fieldMap["coin_id"] = p.CoinID p.fieldMap["done_at"] = p.DoneAt p.fieldMap["is_wait"] = p.IsWait } func (p projectUserCoinExpired) clone(db *gorm.DB) projectUserCoinExpired { p.projectUserCoinExpiredDo.ReplaceConnPool(db.Statement.ConnPool) return p } func (p projectUserCoinExpired) replaceDB(db *gorm.DB) projectUserCoinExpired { p.projectUserCoinExpiredDo.ReplaceDB(db) return p } type projectUserCoinExpiredDo struct{ gen.DO } func (p projectUserCoinExpiredDo) Debug() *projectUserCoinExpiredDo { return p.withDO(p.DO.Debug()) } func (p projectUserCoinExpiredDo) WithContext(ctx context.Context) *projectUserCoinExpiredDo { return p.withDO(p.DO.WithContext(ctx)) } func (p projectUserCoinExpiredDo) ReadDB() *projectUserCoinExpiredDo { return p.Clauses(dbresolver.Read) } func (p projectUserCoinExpiredDo) WriteDB() *projectUserCoinExpiredDo { return p.Clauses(dbresolver.Write) } func (p projectUserCoinExpiredDo) Session(config *gorm.Session) *projectUserCoinExpiredDo { return p.withDO(p.DO.Session(config)) } func (p projectUserCoinExpiredDo) Clauses(conds ...clause.Expression) *projectUserCoinExpiredDo { return p.withDO(p.DO.Clauses(conds...)) } func (p projectUserCoinExpiredDo) Returning(value interface{}, columns ...string) *projectUserCoinExpiredDo { return p.withDO(p.DO.Returning(value, columns...)) } func (p projectUserCoinExpiredDo) Not(conds ...gen.Condition) *projectUserCoinExpiredDo { return p.withDO(p.DO.Not(conds...)) } func (p projectUserCoinExpiredDo) Or(conds ...gen.Condition) *projectUserCoinExpiredDo { return p.withDO(p.DO.Or(conds...)) } func (p projectUserCoinExpiredDo) Select(conds ...field.Expr) *projectUserCoinExpiredDo { return p.withDO(p.DO.Select(conds...)) } func (p projectUserCoinExpiredDo) Where(conds ...gen.Condition) *projectUserCoinExpiredDo { return p.withDO(p.DO.Where(conds...)) } func (p projectUserCoinExpiredDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *projectUserCoinExpiredDo { return p.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (p projectUserCoinExpiredDo) Order(conds ...field.Expr) *projectUserCoinExpiredDo { return p.withDO(p.DO.Order(conds...)) } func (p projectUserCoinExpiredDo) Distinct(cols ...field.Expr) *projectUserCoinExpiredDo { return p.withDO(p.DO.Distinct(cols...)) } func (p projectUserCoinExpiredDo) Omit(cols ...field.Expr) *projectUserCoinExpiredDo { return p.withDO(p.DO.Omit(cols...)) } func (p projectUserCoinExpiredDo) Join(table schema.Tabler, on ...field.Expr) *projectUserCoinExpiredDo { return p.withDO(p.DO.Join(table, on...)) } func (p projectUserCoinExpiredDo) LeftJoin(table schema.Tabler, on ...field.Expr) *projectUserCoinExpiredDo { return p.withDO(p.DO.LeftJoin(table, on...)) } func (p projectUserCoinExpiredDo) RightJoin(table schema.Tabler, on ...field.Expr) *projectUserCoinExpiredDo { return p.withDO(p.DO.RightJoin(table, on...)) } func (p projectUserCoinExpiredDo) Group(cols ...field.Expr) *projectUserCoinExpiredDo { return p.withDO(p.DO.Group(cols...)) } func (p projectUserCoinExpiredDo) Having(conds ...gen.Condition) *projectUserCoinExpiredDo { return p.withDO(p.DO.Having(conds...)) } func (p projectUserCoinExpiredDo) Limit(limit int) *projectUserCoinExpiredDo { return p.withDO(p.DO.Limit(limit)) } func (p projectUserCoinExpiredDo) Offset(offset int) *projectUserCoinExpiredDo { return p.withDO(p.DO.Offset(offset)) } func (p projectUserCoinExpiredDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *projectUserCoinExpiredDo { return p.withDO(p.DO.Scopes(funcs...)) } func (p projectUserCoinExpiredDo) Unscoped() *projectUserCoinExpiredDo { return p.withDO(p.DO.Unscoped()) } func (p projectUserCoinExpiredDo) Create(values ...*model.ProjectUserCoinExpired) error { if len(values) == 0 { return nil } return p.DO.Create(values) } func (p projectUserCoinExpiredDo) CreateInBatches(values []*model.ProjectUserCoinExpired, 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 projectUserCoinExpiredDo) Save(values ...*model.ProjectUserCoinExpired) error { if len(values) == 0 { return nil } return p.DO.Save(values) } func (p projectUserCoinExpiredDo) First() (*model.ProjectUserCoinExpired, error) { if result, err := p.DO.First(); err != nil { return nil, err } else { return result.(*model.ProjectUserCoinExpired), nil } } func (p projectUserCoinExpiredDo) Take() (*model.ProjectUserCoinExpired, error) { if result, err := p.DO.Take(); err != nil { return nil, err } else { return result.(*model.ProjectUserCoinExpired), nil } } func (p projectUserCoinExpiredDo) Last() (*model.ProjectUserCoinExpired, error) { if result, err := p.DO.Last(); err != nil { return nil, err } else { return result.(*model.ProjectUserCoinExpired), nil } } func (p projectUserCoinExpiredDo) Find() ([]*model.ProjectUserCoinExpired, error) { result, err := p.DO.Find() return result.([]*model.ProjectUserCoinExpired), err } func (p projectUserCoinExpiredDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ProjectUserCoinExpired, err error) { buf := make([]*model.ProjectUserCoinExpired, 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 projectUserCoinExpiredDo) FindInBatches(result *[]*model.ProjectUserCoinExpired, batchSize int, fc func(tx gen.Dao, batch int) error) error { return p.DO.FindInBatches(result, batchSize, fc) } func (p projectUserCoinExpiredDo) Attrs(attrs ...field.AssignExpr) *projectUserCoinExpiredDo { return p.withDO(p.DO.Attrs(attrs...)) } func (p projectUserCoinExpiredDo) Assign(attrs ...field.AssignExpr) *projectUserCoinExpiredDo { return p.withDO(p.DO.Assign(attrs...)) } func (p projectUserCoinExpiredDo) Joins(fields ...field.RelationField) *projectUserCoinExpiredDo { for _, _f := range fields { p = *p.withDO(p.DO.Joins(_f)) } return &p } func (p projectUserCoinExpiredDo) Preload(fields ...field.RelationField) *projectUserCoinExpiredDo { for _, _f := range fields { p = *p.withDO(p.DO.Preload(_f)) } return &p } func (p projectUserCoinExpiredDo) FirstOrInit() (*model.ProjectUserCoinExpired, error) { if result, err := p.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.ProjectUserCoinExpired), nil } } func (p projectUserCoinExpiredDo) FirstOrCreate() (*model.ProjectUserCoinExpired, error) { if result, err := p.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.ProjectUserCoinExpired), nil } } func (p projectUserCoinExpiredDo) FindByPage(offset int, limit int) (result []*model.ProjectUserCoinExpired, 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 projectUserCoinExpiredDo) 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 projectUserCoinExpiredDo) Scan(result interface{}) (err error) { return p.DO.Scan(result) } func (p projectUserCoinExpiredDo) Delete(models ...*model.ProjectUserCoinExpired) (result gen.ResultInfo, err error) { return p.DO.Delete(models) } func (p *projectUserCoinExpiredDo) withDO(do gen.Dao) *projectUserCoinExpiredDo { p.DO = *do.(*gen.DO) return p }