// 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" "gadmin/internal/gorm/model" ) func newReportDayFirstAdv(db *gorm.DB, opts ...gen.DOOption) reportDayFirstAdv { _reportDayFirstAdv := reportDayFirstAdv{} _reportDayFirstAdv.reportDayFirstAdvDo.UseDB(db, opts...) _reportDayFirstAdv.reportDayFirstAdvDo.UseModel(&model.ReportDayFirstAdv{}) tableName := _reportDayFirstAdv.reportDayFirstAdvDo.TableName() _reportDayFirstAdv.ALL = field.NewAsterisk(tableName) _reportDayFirstAdv.ID = field.NewInt64(tableName, "id") _reportDayFirstAdv.Date = field.NewString(tableName, "date") _reportDayFirstAdv.ChannelID = field.NewString(tableName, "channel_id") _reportDayFirstAdv.ServerID = field.NewInt32(tableName, "server_id") _reportDayFirstAdv.Goto = field.NewInt64(tableName, "goto") _reportDayFirstAdv.A = field.NewInt64(tableName, "a") _reportDayFirstAdv.B = field.NewInt64(tableName, "b") _reportDayFirstAdv.C = field.NewInt64(tableName, "c") _reportDayFirstAdv.Waive = field.NewInt64(tableName, "waive") _reportDayFirstAdv.EquipNow = field.NewInt64(tableName, "equip_now") _reportDayFirstAdv.fillFieldMap() return _reportDayFirstAdv } type reportDayFirstAdv struct { reportDayFirstAdvDo ALL field.Asterisk ID field.Int64 Date field.String ChannelID field.String // 渠道ID ServerID field.Int32 // 服务器ID Goto field.Int64 A field.Int64 B field.Int64 C field.Int64 Waive field.Int64 EquipNow field.Int64 fieldMap map[string]field.Expr } func (r reportDayFirstAdv) Table(newTableName string) *reportDayFirstAdv { r.reportDayFirstAdvDo.UseTable(newTableName) return r.updateTableName(newTableName) } func (r reportDayFirstAdv) As(alias string) *reportDayFirstAdv { r.reportDayFirstAdvDo.DO = *(r.reportDayFirstAdvDo.As(alias).(*gen.DO)) return r.updateTableName(alias) } func (r *reportDayFirstAdv) updateTableName(table string) *reportDayFirstAdv { r.ALL = field.NewAsterisk(table) r.ID = field.NewInt64(table, "id") r.Date = field.NewString(table, "date") r.ChannelID = field.NewString(table, "channel_id") r.ServerID = field.NewInt32(table, "server_id") r.Goto = field.NewInt64(table, "goto") r.A = field.NewInt64(table, "a") r.B = field.NewInt64(table, "b") r.C = field.NewInt64(table, "c") r.Waive = field.NewInt64(table, "waive") r.EquipNow = field.NewInt64(table, "equip_now") r.fillFieldMap() return r } func (r *reportDayFirstAdv) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := r.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (r *reportDayFirstAdv) fillFieldMap() { r.fieldMap = make(map[string]field.Expr, 10) r.fieldMap["id"] = r.ID r.fieldMap["date"] = r.Date r.fieldMap["channel_id"] = r.ChannelID r.fieldMap["server_id"] = r.ServerID r.fieldMap["goto"] = r.Goto r.fieldMap["a"] = r.A r.fieldMap["b"] = r.B r.fieldMap["c"] = r.C r.fieldMap["waive"] = r.Waive r.fieldMap["equip_now"] = r.EquipNow } func (r reportDayFirstAdv) clone(db *gorm.DB) reportDayFirstAdv { r.reportDayFirstAdvDo.ReplaceConnPool(db.Statement.ConnPool) return r } func (r reportDayFirstAdv) replaceDB(db *gorm.DB) reportDayFirstAdv { r.reportDayFirstAdvDo.ReplaceDB(db) return r } type reportDayFirstAdvDo struct{ gen.DO } func (r reportDayFirstAdvDo) Debug() *reportDayFirstAdvDo { return r.withDO(r.DO.Debug()) } func (r reportDayFirstAdvDo) WithContext(ctx context.Context) *reportDayFirstAdvDo { return r.withDO(r.DO.WithContext(ctx)) } func (r reportDayFirstAdvDo) ReadDB() *reportDayFirstAdvDo { return r.Clauses(dbresolver.Read) } func (r reportDayFirstAdvDo) WriteDB() *reportDayFirstAdvDo { return r.Clauses(dbresolver.Write) } func (r reportDayFirstAdvDo) Session(config *gorm.Session) *reportDayFirstAdvDo { return r.withDO(r.DO.Session(config)) } func (r reportDayFirstAdvDo) Clauses(conds ...clause.Expression) *reportDayFirstAdvDo { return r.withDO(r.DO.Clauses(conds...)) } func (r reportDayFirstAdvDo) Returning(value interface{}, columns ...string) *reportDayFirstAdvDo { return r.withDO(r.DO.Returning(value, columns...)) } func (r reportDayFirstAdvDo) Not(conds ...gen.Condition) *reportDayFirstAdvDo { return r.withDO(r.DO.Not(conds...)) } func (r reportDayFirstAdvDo) Or(conds ...gen.Condition) *reportDayFirstAdvDo { return r.withDO(r.DO.Or(conds...)) } func (r reportDayFirstAdvDo) Select(conds ...field.Expr) *reportDayFirstAdvDo { return r.withDO(r.DO.Select(conds...)) } func (r reportDayFirstAdvDo) Where(conds ...gen.Condition) *reportDayFirstAdvDo { return r.withDO(r.DO.Where(conds...)) } func (r reportDayFirstAdvDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayFirstAdvDo { return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (r reportDayFirstAdvDo) Order(conds ...field.Expr) *reportDayFirstAdvDo { return r.withDO(r.DO.Order(conds...)) } func (r reportDayFirstAdvDo) Distinct(cols ...field.Expr) *reportDayFirstAdvDo { return r.withDO(r.DO.Distinct(cols...)) } func (r reportDayFirstAdvDo) Omit(cols ...field.Expr) *reportDayFirstAdvDo { return r.withDO(r.DO.Omit(cols...)) } func (r reportDayFirstAdvDo) Join(table schema.Tabler, on ...field.Expr) *reportDayFirstAdvDo { return r.withDO(r.DO.Join(table, on...)) } func (r reportDayFirstAdvDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayFirstAdvDo { return r.withDO(r.DO.LeftJoin(table, on...)) } func (r reportDayFirstAdvDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayFirstAdvDo { return r.withDO(r.DO.RightJoin(table, on...)) } func (r reportDayFirstAdvDo) Group(cols ...field.Expr) *reportDayFirstAdvDo { return r.withDO(r.DO.Group(cols...)) } func (r reportDayFirstAdvDo) Having(conds ...gen.Condition) *reportDayFirstAdvDo { return r.withDO(r.DO.Having(conds...)) } func (r reportDayFirstAdvDo) Limit(limit int) *reportDayFirstAdvDo { return r.withDO(r.DO.Limit(limit)) } func (r reportDayFirstAdvDo) Offset(offset int) *reportDayFirstAdvDo { return r.withDO(r.DO.Offset(offset)) } func (r reportDayFirstAdvDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayFirstAdvDo { return r.withDO(r.DO.Scopes(funcs...)) } func (r reportDayFirstAdvDo) Unscoped() *reportDayFirstAdvDo { return r.withDO(r.DO.Unscoped()) } func (r reportDayFirstAdvDo) Create(values ...*model.ReportDayFirstAdv) error { if len(values) == 0 { return nil } return r.DO.Create(values) } func (r reportDayFirstAdvDo) CreateInBatches(values []*model.ReportDayFirstAdv, batchSize int) error { return r.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 (r reportDayFirstAdvDo) Save(values ...*model.ReportDayFirstAdv) error { if len(values) == 0 { return nil } return r.DO.Save(values) } func (r reportDayFirstAdvDo) First() (*model.ReportDayFirstAdv, error) { if result, err := r.DO.First(); err != nil { return nil, err } else { return result.(*model.ReportDayFirstAdv), nil } } func (r reportDayFirstAdvDo) Take() (*model.ReportDayFirstAdv, error) { if result, err := r.DO.Take(); err != nil { return nil, err } else { return result.(*model.ReportDayFirstAdv), nil } } func (r reportDayFirstAdvDo) Last() (*model.ReportDayFirstAdv, error) { if result, err := r.DO.Last(); err != nil { return nil, err } else { return result.(*model.ReportDayFirstAdv), nil } } func (r reportDayFirstAdvDo) Find() ([]*model.ReportDayFirstAdv, error) { result, err := r.DO.Find() return result.([]*model.ReportDayFirstAdv), err } func (r reportDayFirstAdvDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayFirstAdv, err error) { buf := make([]*model.ReportDayFirstAdv, 0, batchSize) err = r.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 (r reportDayFirstAdvDo) FindInBatches(result *[]*model.ReportDayFirstAdv, batchSize int, fc func(tx gen.Dao, batch int) error) error { return r.DO.FindInBatches(result, batchSize, fc) } func (r reportDayFirstAdvDo) Attrs(attrs ...field.AssignExpr) *reportDayFirstAdvDo { return r.withDO(r.DO.Attrs(attrs...)) } func (r reportDayFirstAdvDo) Assign(attrs ...field.AssignExpr) *reportDayFirstAdvDo { return r.withDO(r.DO.Assign(attrs...)) } func (r reportDayFirstAdvDo) Joins(fields ...field.RelationField) *reportDayFirstAdvDo { for _, _f := range fields { r = *r.withDO(r.DO.Joins(_f)) } return &r } func (r reportDayFirstAdvDo) Preload(fields ...field.RelationField) *reportDayFirstAdvDo { for _, _f := range fields { r = *r.withDO(r.DO.Preload(_f)) } return &r } func (r reportDayFirstAdvDo) FirstOrInit() (*model.ReportDayFirstAdv, error) { if result, err := r.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.ReportDayFirstAdv), nil } } func (r reportDayFirstAdvDo) FirstOrCreate() (*model.ReportDayFirstAdv, error) { if result, err := r.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.ReportDayFirstAdv), nil } } func (r reportDayFirstAdvDo) FindByPage(offset int, limit int) (result []*model.ReportDayFirstAdv, count int64, err error) { result, err = r.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 = r.Offset(-1).Limit(-1).Count() return } func (r reportDayFirstAdvDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = r.Count() if err != nil { return } err = r.Offset(offset).Limit(limit).Scan(result) return } func (r reportDayFirstAdvDo) Scan(result interface{}) (err error) { return r.DO.Scan(result) } func (r reportDayFirstAdvDo) Delete(models ...*model.ReportDayFirstAdv) (result gen.ResultInfo, err error) { return r.DO.Delete(models) } func (r *reportDayFirstAdvDo) withDO(do gen.Dao) *reportDayFirstAdvDo { r.DO = *do.(*gen.DO) return r }