// 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 newReportDayIdiom(db *gorm.DB, opts ...gen.DOOption) reportDayIdiom { _reportDayIdiom := reportDayIdiom{} _reportDayIdiom.reportDayIdiomDo.UseDB(db, opts...) _reportDayIdiom.reportDayIdiomDo.UseModel(&model.ReportDayIdiom{}) tableName := _reportDayIdiom.reportDayIdiomDo.TableName() _reportDayIdiom.ALL = field.NewAsterisk(tableName) _reportDayIdiom.ID = field.NewInt64(tableName, "id") _reportDayIdiom.Date = field.NewString(tableName, "date") _reportDayIdiom.ChannelID = field.NewString(tableName, "channel_id") _reportDayIdiom.ServerID = field.NewInt32(tableName, "server_id") _reportDayIdiom.PlayerCount = field.NewInt64(tableName, "player_count") _reportDayIdiom.BreakCount = field.NewInt64(tableName, "break_count") _reportDayIdiom.TipsCount = field.NewInt64(tableName, "tips_count") _reportDayIdiom.IntegralCount = field.NewInt64(tableName, "integral_count") _reportDayIdiom.GearData = field.NewString(tableName, "gear_data") _reportDayIdiom.ReceiveCount = field.NewInt64(tableName, "receive_count") _reportDayIdiom.InkAdvCount = field.NewInt64(tableName, "ink_adv_count") _reportDayIdiom.InkDrillCount = field.NewInt64(tableName, "ink_drill_count") _reportDayIdiom.RankingCount = field.NewInt64(tableName, "ranking_count") _reportDayIdiom.AwardCount = field.NewInt64(tableName, "award_count") _reportDayIdiom.fillFieldMap() return _reportDayIdiom } type reportDayIdiom struct { reportDayIdiomDo ALL field.Asterisk ID field.Int64 // ID Date field.String // 日期 ChannelID field.String // 渠道ID ServerID field.Int32 // 服务器ID PlayerCount field.Int64 // 参与人数 BreakCount field.Int64 // 闯关次数 TipsCount field.Int64 // 使用锦囊次数 IntegralCount field.Int64 // 全部积分数量 GearData field.String // {领取档位:数量} ReceiveCount field.Int64 // 累计领取奖励次数 InkAdvCount field.Int64 // 看广告获得墨水次数 InkDrillCount field.Int64 // 钻石获得墨水次数 RankingCount field.Int64 // 查看排行榜次数 AwardCount field.Int64 // 查看排行榜奖励次数 fieldMap map[string]field.Expr } func (r reportDayIdiom) Table(newTableName string) *reportDayIdiom { r.reportDayIdiomDo.UseTable(newTableName) return r.updateTableName(newTableName) } func (r reportDayIdiom) As(alias string) *reportDayIdiom { r.reportDayIdiomDo.DO = *(r.reportDayIdiomDo.As(alias).(*gen.DO)) return r.updateTableName(alias) } func (r *reportDayIdiom) updateTableName(table string) *reportDayIdiom { 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.PlayerCount = field.NewInt64(table, "player_count") r.BreakCount = field.NewInt64(table, "break_count") r.TipsCount = field.NewInt64(table, "tips_count") r.IntegralCount = field.NewInt64(table, "integral_count") r.GearData = field.NewString(table, "gear_data") r.ReceiveCount = field.NewInt64(table, "receive_count") r.InkAdvCount = field.NewInt64(table, "ink_adv_count") r.InkDrillCount = field.NewInt64(table, "ink_drill_count") r.RankingCount = field.NewInt64(table, "ranking_count") r.AwardCount = field.NewInt64(table, "award_count") r.fillFieldMap() return r } func (r *reportDayIdiom) 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 *reportDayIdiom) fillFieldMap() { r.fieldMap = make(map[string]field.Expr, 14) r.fieldMap["id"] = r.ID r.fieldMap["date"] = r.Date r.fieldMap["channel_id"] = r.ChannelID r.fieldMap["server_id"] = r.ServerID r.fieldMap["player_count"] = r.PlayerCount r.fieldMap["break_count"] = r.BreakCount r.fieldMap["tips_count"] = r.TipsCount r.fieldMap["integral_count"] = r.IntegralCount r.fieldMap["gear_data"] = r.GearData r.fieldMap["receive_count"] = r.ReceiveCount r.fieldMap["ink_adv_count"] = r.InkAdvCount r.fieldMap["ink_drill_count"] = r.InkDrillCount r.fieldMap["ranking_count"] = r.RankingCount r.fieldMap["award_count"] = r.AwardCount } func (r reportDayIdiom) clone(db *gorm.DB) reportDayIdiom { r.reportDayIdiomDo.ReplaceConnPool(db.Statement.ConnPool) return r } func (r reportDayIdiom) replaceDB(db *gorm.DB) reportDayIdiom { r.reportDayIdiomDo.ReplaceDB(db) return r } type reportDayIdiomDo struct{ gen.DO } func (r reportDayIdiomDo) Debug() *reportDayIdiomDo { return r.withDO(r.DO.Debug()) } func (r reportDayIdiomDo) WithContext(ctx context.Context) *reportDayIdiomDo { return r.withDO(r.DO.WithContext(ctx)) } func (r reportDayIdiomDo) ReadDB() *reportDayIdiomDo { return r.Clauses(dbresolver.Read) } func (r reportDayIdiomDo) WriteDB() *reportDayIdiomDo { return r.Clauses(dbresolver.Write) } func (r reportDayIdiomDo) Session(config *gorm.Session) *reportDayIdiomDo { return r.withDO(r.DO.Session(config)) } func (r reportDayIdiomDo) Clauses(conds ...clause.Expression) *reportDayIdiomDo { return r.withDO(r.DO.Clauses(conds...)) } func (r reportDayIdiomDo) Returning(value interface{}, columns ...string) *reportDayIdiomDo { return r.withDO(r.DO.Returning(value, columns...)) } func (r reportDayIdiomDo) Not(conds ...gen.Condition) *reportDayIdiomDo { return r.withDO(r.DO.Not(conds...)) } func (r reportDayIdiomDo) Or(conds ...gen.Condition) *reportDayIdiomDo { return r.withDO(r.DO.Or(conds...)) } func (r reportDayIdiomDo) Select(conds ...field.Expr) *reportDayIdiomDo { return r.withDO(r.DO.Select(conds...)) } func (r reportDayIdiomDo) Where(conds ...gen.Condition) *reportDayIdiomDo { return r.withDO(r.DO.Where(conds...)) } func (r reportDayIdiomDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayIdiomDo { return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (r reportDayIdiomDo) Order(conds ...field.Expr) *reportDayIdiomDo { return r.withDO(r.DO.Order(conds...)) } func (r reportDayIdiomDo) Distinct(cols ...field.Expr) *reportDayIdiomDo { return r.withDO(r.DO.Distinct(cols...)) } func (r reportDayIdiomDo) Omit(cols ...field.Expr) *reportDayIdiomDo { return r.withDO(r.DO.Omit(cols...)) } func (r reportDayIdiomDo) Join(table schema.Tabler, on ...field.Expr) *reportDayIdiomDo { return r.withDO(r.DO.Join(table, on...)) } func (r reportDayIdiomDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayIdiomDo { return r.withDO(r.DO.LeftJoin(table, on...)) } func (r reportDayIdiomDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayIdiomDo { return r.withDO(r.DO.RightJoin(table, on...)) } func (r reportDayIdiomDo) Group(cols ...field.Expr) *reportDayIdiomDo { return r.withDO(r.DO.Group(cols...)) } func (r reportDayIdiomDo) Having(conds ...gen.Condition) *reportDayIdiomDo { return r.withDO(r.DO.Having(conds...)) } func (r reportDayIdiomDo) Limit(limit int) *reportDayIdiomDo { return r.withDO(r.DO.Limit(limit)) } func (r reportDayIdiomDo) Offset(offset int) *reportDayIdiomDo { return r.withDO(r.DO.Offset(offset)) } func (r reportDayIdiomDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayIdiomDo { return r.withDO(r.DO.Scopes(funcs...)) } func (r reportDayIdiomDo) Unscoped() *reportDayIdiomDo { return r.withDO(r.DO.Unscoped()) } func (r reportDayIdiomDo) Create(values ...*model.ReportDayIdiom) error { if len(values) == 0 { return nil } return r.DO.Create(values) } func (r reportDayIdiomDo) CreateInBatches(values []*model.ReportDayIdiom, 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 reportDayIdiomDo) Save(values ...*model.ReportDayIdiom) error { if len(values) == 0 { return nil } return r.DO.Save(values) } func (r reportDayIdiomDo) First() (*model.ReportDayIdiom, error) { if result, err := r.DO.First(); err != nil { return nil, err } else { return result.(*model.ReportDayIdiom), nil } } func (r reportDayIdiomDo) Take() (*model.ReportDayIdiom, error) { if result, err := r.DO.Take(); err != nil { return nil, err } else { return result.(*model.ReportDayIdiom), nil } } func (r reportDayIdiomDo) Last() (*model.ReportDayIdiom, error) { if result, err := r.DO.Last(); err != nil { return nil, err } else { return result.(*model.ReportDayIdiom), nil } } func (r reportDayIdiomDo) Find() ([]*model.ReportDayIdiom, error) { result, err := r.DO.Find() return result.([]*model.ReportDayIdiom), err } func (r reportDayIdiomDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayIdiom, err error) { buf := make([]*model.ReportDayIdiom, 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 reportDayIdiomDo) FindInBatches(result *[]*model.ReportDayIdiom, batchSize int, fc func(tx gen.Dao, batch int) error) error { return r.DO.FindInBatches(result, batchSize, fc) } func (r reportDayIdiomDo) Attrs(attrs ...field.AssignExpr) *reportDayIdiomDo { return r.withDO(r.DO.Attrs(attrs...)) } func (r reportDayIdiomDo) Assign(attrs ...field.AssignExpr) *reportDayIdiomDo { return r.withDO(r.DO.Assign(attrs...)) } func (r reportDayIdiomDo) Joins(fields ...field.RelationField) *reportDayIdiomDo { for _, _f := range fields { r = *r.withDO(r.DO.Joins(_f)) } return &r } func (r reportDayIdiomDo) Preload(fields ...field.RelationField) *reportDayIdiomDo { for _, _f := range fields { r = *r.withDO(r.DO.Preload(_f)) } return &r } func (r reportDayIdiomDo) FirstOrInit() (*model.ReportDayIdiom, error) { if result, err := r.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.ReportDayIdiom), nil } } func (r reportDayIdiomDo) FirstOrCreate() (*model.ReportDayIdiom, error) { if result, err := r.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.ReportDayIdiom), nil } } func (r reportDayIdiomDo) FindByPage(offset int, limit int) (result []*model.ReportDayIdiom, 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 reportDayIdiomDo) 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 reportDayIdiomDo) Scan(result interface{}) (err error) { return r.DO.Scan(result) } func (r reportDayIdiomDo) Delete(models ...*model.ReportDayIdiom) (result gen.ResultInfo, err error) { return r.DO.Delete(models) } func (r *reportDayIdiomDo) withDO(do gen.Dao) *reportDayIdiomDo { r.DO = *do.(*gen.DO) return r }