// 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 newReportDaySeven(db *gorm.DB, opts ...gen.DOOption) reportDaySeven { _reportDaySeven := reportDaySeven{} _reportDaySeven.reportDaySevenDo.UseDB(db, opts...) _reportDaySeven.reportDaySevenDo.UseModel(&model.ReportDaySeven{}) tableName := _reportDaySeven.reportDaySevenDo.TableName() _reportDaySeven.ALL = field.NewAsterisk(tableName) _reportDaySeven.ID = field.NewInt64(tableName, "id") _reportDaySeven.Date = field.NewString(tableName, "date") _reportDaySeven.ChannelID = field.NewString(tableName, "channel_id") _reportDaySeven.ServerID = field.NewInt32(tableName, "server_id") _reportDaySeven.Org = field.NewInt64(tableName, "org") _reportDaySeven.PlayerCount = field.NewInt64(tableName, "player_count") _reportDaySeven.NewPlayerCount = field.NewInt64(tableName, "new_player_count") _reportDaySeven.OpenCount = field.NewInt64(tableName, "open_count") _reportDaySeven.AllTaskSucCount = field.NewInt64(tableName, "all_task_suc_count") _reportDaySeven.Unlock1 = field.NewInt64(tableName, "unlock1") _reportDaySeven.Unlock2 = field.NewInt64(tableName, "unlock2") _reportDaySeven.Unlock3 = field.NewInt64(tableName, "unlock3") _reportDaySeven.Unlock4 = field.NewInt64(tableName, "unlock4") _reportDaySeven.Unlock5 = field.NewInt64(tableName, "unlock5") _reportDaySeven.Unlock6 = field.NewInt64(tableName, "unlock6") _reportDaySeven.Unlock7 = field.NewInt64(tableName, "unlock7") _reportDaySeven.TaskID = field.NewInt64(tableName, "task_id") _reportDaySeven.TaskSucCount = field.NewInt64(tableName, "task_suc_count") _reportDaySeven.AdvSucDay = field.NewFloat64(tableName, "adv_suc_day") _reportDaySeven.fillFieldMap() return _reportDaySeven } type reportDaySeven struct { reportDaySevenDo ALL field.Asterisk ID field.Int64 // ID Date field.String // 日期 ChannelID field.String // 渠道ID ServerID field.Int32 // 服务器ID Org field.Int64 // 统计组 PlayerCount field.Int64 // 参与人数 NewPlayerCount field.Int64 // 打开界面的新玩家(当天注册) OpenCount field.Int64 // 打开界面总数 AllTaskSucCount field.Int64 // 当天所有任务完成总数 Unlock1 field.Int64 // 解锁1天 Unlock2 field.Int64 // 解锁2天 Unlock3 field.Int64 // 解锁3天 Unlock4 field.Int64 // 解锁4天 Unlock5 field.Int64 // 解锁5天 Unlock6 field.Int64 // 解锁6天 Unlock7 field.Int64 // 解锁7天 TaskID field.Int64 // 任务或奖励ID TaskSucCount field.Int64 // 当天任务完成总数 AdvSucDay field.Float64 // 任务平均完成天数 fieldMap map[string]field.Expr } func (r reportDaySeven) Table(newTableName string) *reportDaySeven { r.reportDaySevenDo.UseTable(newTableName) return r.updateTableName(newTableName) } func (r reportDaySeven) As(alias string) *reportDaySeven { r.reportDaySevenDo.DO = *(r.reportDaySevenDo.As(alias).(*gen.DO)) return r.updateTableName(alias) } func (r *reportDaySeven) updateTableName(table string) *reportDaySeven { 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.Org = field.NewInt64(table, "org") r.PlayerCount = field.NewInt64(table, "player_count") r.NewPlayerCount = field.NewInt64(table, "new_player_count") r.OpenCount = field.NewInt64(table, "open_count") r.AllTaskSucCount = field.NewInt64(table, "all_task_suc_count") r.Unlock1 = field.NewInt64(table, "unlock1") r.Unlock2 = field.NewInt64(table, "unlock2") r.Unlock3 = field.NewInt64(table, "unlock3") r.Unlock4 = field.NewInt64(table, "unlock4") r.Unlock5 = field.NewInt64(table, "unlock5") r.Unlock6 = field.NewInt64(table, "unlock6") r.Unlock7 = field.NewInt64(table, "unlock7") r.TaskID = field.NewInt64(table, "task_id") r.TaskSucCount = field.NewInt64(table, "task_suc_count") r.AdvSucDay = field.NewFloat64(table, "adv_suc_day") r.fillFieldMap() return r } func (r *reportDaySeven) 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 *reportDaySeven) fillFieldMap() { r.fieldMap = make(map[string]field.Expr, 19) r.fieldMap["id"] = r.ID r.fieldMap["date"] = r.Date r.fieldMap["channel_id"] = r.ChannelID r.fieldMap["server_id"] = r.ServerID r.fieldMap["org"] = r.Org r.fieldMap["player_count"] = r.PlayerCount r.fieldMap["new_player_count"] = r.NewPlayerCount r.fieldMap["open_count"] = r.OpenCount r.fieldMap["all_task_suc_count"] = r.AllTaskSucCount r.fieldMap["unlock1"] = r.Unlock1 r.fieldMap["unlock2"] = r.Unlock2 r.fieldMap["unlock3"] = r.Unlock3 r.fieldMap["unlock4"] = r.Unlock4 r.fieldMap["unlock5"] = r.Unlock5 r.fieldMap["unlock6"] = r.Unlock6 r.fieldMap["unlock7"] = r.Unlock7 r.fieldMap["task_id"] = r.TaskID r.fieldMap["task_suc_count"] = r.TaskSucCount r.fieldMap["adv_suc_day"] = r.AdvSucDay } func (r reportDaySeven) clone(db *gorm.DB) reportDaySeven { r.reportDaySevenDo.ReplaceConnPool(db.Statement.ConnPool) return r } func (r reportDaySeven) replaceDB(db *gorm.DB) reportDaySeven { r.reportDaySevenDo.ReplaceDB(db) return r } type reportDaySevenDo struct{ gen.DO } func (r reportDaySevenDo) Debug() *reportDaySevenDo { return r.withDO(r.DO.Debug()) } func (r reportDaySevenDo) WithContext(ctx context.Context) *reportDaySevenDo { return r.withDO(r.DO.WithContext(ctx)) } func (r reportDaySevenDo) ReadDB() *reportDaySevenDo { return r.Clauses(dbresolver.Read) } func (r reportDaySevenDo) WriteDB() *reportDaySevenDo { return r.Clauses(dbresolver.Write) } func (r reportDaySevenDo) Session(config *gorm.Session) *reportDaySevenDo { return r.withDO(r.DO.Session(config)) } func (r reportDaySevenDo) Clauses(conds ...clause.Expression) *reportDaySevenDo { return r.withDO(r.DO.Clauses(conds...)) } func (r reportDaySevenDo) Returning(value interface{}, columns ...string) *reportDaySevenDo { return r.withDO(r.DO.Returning(value, columns...)) } func (r reportDaySevenDo) Not(conds ...gen.Condition) *reportDaySevenDo { return r.withDO(r.DO.Not(conds...)) } func (r reportDaySevenDo) Or(conds ...gen.Condition) *reportDaySevenDo { return r.withDO(r.DO.Or(conds...)) } func (r reportDaySevenDo) Select(conds ...field.Expr) *reportDaySevenDo { return r.withDO(r.DO.Select(conds...)) } func (r reportDaySevenDo) Where(conds ...gen.Condition) *reportDaySevenDo { return r.withDO(r.DO.Where(conds...)) } func (r reportDaySevenDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDaySevenDo { return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (r reportDaySevenDo) Order(conds ...field.Expr) *reportDaySevenDo { return r.withDO(r.DO.Order(conds...)) } func (r reportDaySevenDo) Distinct(cols ...field.Expr) *reportDaySevenDo { return r.withDO(r.DO.Distinct(cols...)) } func (r reportDaySevenDo) Omit(cols ...field.Expr) *reportDaySevenDo { return r.withDO(r.DO.Omit(cols...)) } func (r reportDaySevenDo) Join(table schema.Tabler, on ...field.Expr) *reportDaySevenDo { return r.withDO(r.DO.Join(table, on...)) } func (r reportDaySevenDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDaySevenDo { return r.withDO(r.DO.LeftJoin(table, on...)) } func (r reportDaySevenDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDaySevenDo { return r.withDO(r.DO.RightJoin(table, on...)) } func (r reportDaySevenDo) Group(cols ...field.Expr) *reportDaySevenDo { return r.withDO(r.DO.Group(cols...)) } func (r reportDaySevenDo) Having(conds ...gen.Condition) *reportDaySevenDo { return r.withDO(r.DO.Having(conds...)) } func (r reportDaySevenDo) Limit(limit int) *reportDaySevenDo { return r.withDO(r.DO.Limit(limit)) } func (r reportDaySevenDo) Offset(offset int) *reportDaySevenDo { return r.withDO(r.DO.Offset(offset)) } func (r reportDaySevenDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDaySevenDo { return r.withDO(r.DO.Scopes(funcs...)) } func (r reportDaySevenDo) Unscoped() *reportDaySevenDo { return r.withDO(r.DO.Unscoped()) } func (r reportDaySevenDo) Create(values ...*model.ReportDaySeven) error { if len(values) == 0 { return nil } return r.DO.Create(values) } func (r reportDaySevenDo) CreateInBatches(values []*model.ReportDaySeven, 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 reportDaySevenDo) Save(values ...*model.ReportDaySeven) error { if len(values) == 0 { return nil } return r.DO.Save(values) } func (r reportDaySevenDo) First() (*model.ReportDaySeven, error) { if result, err := r.DO.First(); err != nil { return nil, err } else { return result.(*model.ReportDaySeven), nil } } func (r reportDaySevenDo) Take() (*model.ReportDaySeven, error) { if result, err := r.DO.Take(); err != nil { return nil, err } else { return result.(*model.ReportDaySeven), nil } } func (r reportDaySevenDo) Last() (*model.ReportDaySeven, error) { if result, err := r.DO.Last(); err != nil { return nil, err } else { return result.(*model.ReportDaySeven), nil } } func (r reportDaySevenDo) Find() ([]*model.ReportDaySeven, error) { result, err := r.DO.Find() return result.([]*model.ReportDaySeven), err } func (r reportDaySevenDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDaySeven, err error) { buf := make([]*model.ReportDaySeven, 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 reportDaySevenDo) FindInBatches(result *[]*model.ReportDaySeven, batchSize int, fc func(tx gen.Dao, batch int) error) error { return r.DO.FindInBatches(result, batchSize, fc) } func (r reportDaySevenDo) Attrs(attrs ...field.AssignExpr) *reportDaySevenDo { return r.withDO(r.DO.Attrs(attrs...)) } func (r reportDaySevenDo) Assign(attrs ...field.AssignExpr) *reportDaySevenDo { return r.withDO(r.DO.Assign(attrs...)) } func (r reportDaySevenDo) Joins(fields ...field.RelationField) *reportDaySevenDo { for _, _f := range fields { r = *r.withDO(r.DO.Joins(_f)) } return &r } func (r reportDaySevenDo) Preload(fields ...field.RelationField) *reportDaySevenDo { for _, _f := range fields { r = *r.withDO(r.DO.Preload(_f)) } return &r } func (r reportDaySevenDo) FirstOrInit() (*model.ReportDaySeven, error) { if result, err := r.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.ReportDaySeven), nil } } func (r reportDaySevenDo) FirstOrCreate() (*model.ReportDaySeven, error) { if result, err := r.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.ReportDaySeven), nil } } func (r reportDaySevenDo) FindByPage(offset int, limit int) (result []*model.ReportDaySeven, 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 reportDaySevenDo) 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 reportDaySevenDo) Scan(result interface{}) (err error) { return r.DO.Scan(result) } func (r reportDaySevenDo) Delete(models ...*model.ReportDaySeven) (result gen.ResultInfo, err error) { return r.DO.Delete(models) } func (r *reportDaySevenDo) withDO(do gen.Dao) *reportDaySevenDo { r.DO = *do.(*gen.DO) return r }