123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- // 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 newReportDayDuel(db *gorm.DB, opts ...gen.DOOption) reportDayDuel {
- _reportDayDuel := reportDayDuel{}
- _reportDayDuel.reportDayDuelDo.UseDB(db, opts...)
- _reportDayDuel.reportDayDuelDo.UseModel(&model.ReportDayDuel{})
- tableName := _reportDayDuel.reportDayDuelDo.TableName()
- _reportDayDuel.ALL = field.NewAsterisk(tableName)
- _reportDayDuel.ID = field.NewInt64(tableName, "id")
- _reportDayDuel.Date = field.NewString(tableName, "date")
- _reportDayDuel.ChannelID = field.NewString(tableName, "channel_id")
- _reportDayDuel.ServerID = field.NewInt64(tableName, "server_id")
- _reportDayDuel.PlayerCount = field.NewInt64(tableName, "player_count")
- _reportDayDuel.RefreshCount = field.NewInt64(tableName, "refresh_count")
- _reportDayDuel.DuelCount = field.NewInt64(tableName, "duel_count")
- _reportDayDuel.DuelFreeCount = field.NewInt64(tableName, "duel_free_count")
- _reportDayDuel.DuelBattleCount = field.NewInt64(tableName, "duel_battle_count")
- _reportDayDuel.DuelRevengeCount = field.NewInt64(tableName, "duel_revenge_count")
- _reportDayDuel.BattleAdvCount = field.NewInt64(tableName, "battle_adv_count")
- _reportDayDuel.BattleDrillCount = field.NewInt64(tableName, "battle_drill_count")
- _reportDayDuel.AdjustmentCount = field.NewInt64(tableName, "adjustment_count")
- _reportDayDuel.RevengeCount = field.NewInt64(tableName, "revenge_count")
- _reportDayDuel.RankingCount = field.NewInt64(tableName, "ranking_count")
- _reportDayDuel.AwardCount = field.NewInt64(tableName, "award_count")
- _reportDayDuel.fillFieldMap()
- return _reportDayDuel
- }
- type reportDayDuel struct {
- reportDayDuelDo
- ALL field.Asterisk
- ID field.Int64 // ID
- Date field.String // 日期
- ChannelID field.String // 渠道ID
- ServerID field.Int64 // 服务器ID
- PlayerCount field.Int64 // 参与人数
- RefreshCount field.Int64 // 刷新对手
- DuelCount field.Int64 // 对决次数
- DuelFreeCount field.Int64 // 免费对决次数
- DuelBattleCount field.Int64 // 战帖对决次数
- DuelRevengeCount field.Int64 // 复仇对决次数
- BattleAdvCount field.Int64 // 看广告获得战帖次数
- BattleDrillCount field.Int64 // 钻石获得战帖次数
- AdjustmentCount field.Int64 // 调整角色
- RevengeCount field.Int64 // 复仇次数
- RankingCount field.Int64 // 查看排行榜次数
- AwardCount field.Int64 // 查看排行榜奖励次数
- fieldMap map[string]field.Expr
- }
- func (r reportDayDuel) Table(newTableName string) *reportDayDuel {
- r.reportDayDuelDo.UseTable(newTableName)
- return r.updateTableName(newTableName)
- }
- func (r reportDayDuel) As(alias string) *reportDayDuel {
- r.reportDayDuelDo.DO = *(r.reportDayDuelDo.As(alias).(*gen.DO))
- return r.updateTableName(alias)
- }
- func (r *reportDayDuel) updateTableName(table string) *reportDayDuel {
- 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.NewInt64(table, "server_id")
- r.PlayerCount = field.NewInt64(table, "player_count")
- r.RefreshCount = field.NewInt64(table, "refresh_count")
- r.DuelCount = field.NewInt64(table, "duel_count")
- r.DuelFreeCount = field.NewInt64(table, "duel_free_count")
- r.DuelBattleCount = field.NewInt64(table, "duel_battle_count")
- r.DuelRevengeCount = field.NewInt64(table, "duel_revenge_count")
- r.BattleAdvCount = field.NewInt64(table, "battle_adv_count")
- r.BattleDrillCount = field.NewInt64(table, "battle_drill_count")
- r.AdjustmentCount = field.NewInt64(table, "adjustment_count")
- r.RevengeCount = field.NewInt64(table, "revenge_count")
- r.RankingCount = field.NewInt64(table, "ranking_count")
- r.AwardCount = field.NewInt64(table, "award_count")
- r.fillFieldMap()
- return r
- }
- func (r *reportDayDuel) 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 *reportDayDuel) fillFieldMap() {
- r.fieldMap = make(map[string]field.Expr, 16)
- 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["refresh_count"] = r.RefreshCount
- r.fieldMap["duel_count"] = r.DuelCount
- r.fieldMap["duel_free_count"] = r.DuelFreeCount
- r.fieldMap["duel_battle_count"] = r.DuelBattleCount
- r.fieldMap["duel_revenge_count"] = r.DuelRevengeCount
- r.fieldMap["battle_adv_count"] = r.BattleAdvCount
- r.fieldMap["battle_drill_count"] = r.BattleDrillCount
- r.fieldMap["adjustment_count"] = r.AdjustmentCount
- r.fieldMap["revenge_count"] = r.RevengeCount
- r.fieldMap["ranking_count"] = r.RankingCount
- r.fieldMap["award_count"] = r.AwardCount
- }
- func (r reportDayDuel) clone(db *gorm.DB) reportDayDuel {
- r.reportDayDuelDo.ReplaceConnPool(db.Statement.ConnPool)
- return r
- }
- func (r reportDayDuel) replaceDB(db *gorm.DB) reportDayDuel {
- r.reportDayDuelDo.ReplaceDB(db)
- return r
- }
- type reportDayDuelDo struct{ gen.DO }
- func (r reportDayDuelDo) Debug() *reportDayDuelDo {
- return r.withDO(r.DO.Debug())
- }
- func (r reportDayDuelDo) WithContext(ctx context.Context) *reportDayDuelDo {
- return r.withDO(r.DO.WithContext(ctx))
- }
- func (r reportDayDuelDo) ReadDB() *reportDayDuelDo {
- return r.Clauses(dbresolver.Read)
- }
- func (r reportDayDuelDo) WriteDB() *reportDayDuelDo {
- return r.Clauses(dbresolver.Write)
- }
- func (r reportDayDuelDo) Session(config *gorm.Session) *reportDayDuelDo {
- return r.withDO(r.DO.Session(config))
- }
- func (r reportDayDuelDo) Clauses(conds ...clause.Expression) *reportDayDuelDo {
- return r.withDO(r.DO.Clauses(conds...))
- }
- func (r reportDayDuelDo) Returning(value interface{}, columns ...string) *reportDayDuelDo {
- return r.withDO(r.DO.Returning(value, columns...))
- }
- func (r reportDayDuelDo) Not(conds ...gen.Condition) *reportDayDuelDo {
- return r.withDO(r.DO.Not(conds...))
- }
- func (r reportDayDuelDo) Or(conds ...gen.Condition) *reportDayDuelDo {
- return r.withDO(r.DO.Or(conds...))
- }
- func (r reportDayDuelDo) Select(conds ...field.Expr) *reportDayDuelDo {
- return r.withDO(r.DO.Select(conds...))
- }
- func (r reportDayDuelDo) Where(conds ...gen.Condition) *reportDayDuelDo {
- return r.withDO(r.DO.Where(conds...))
- }
- func (r reportDayDuelDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayDuelDo {
- return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
- }
- func (r reportDayDuelDo) Order(conds ...field.Expr) *reportDayDuelDo {
- return r.withDO(r.DO.Order(conds...))
- }
- func (r reportDayDuelDo) Distinct(cols ...field.Expr) *reportDayDuelDo {
- return r.withDO(r.DO.Distinct(cols...))
- }
- func (r reportDayDuelDo) Omit(cols ...field.Expr) *reportDayDuelDo {
- return r.withDO(r.DO.Omit(cols...))
- }
- func (r reportDayDuelDo) Join(table schema.Tabler, on ...field.Expr) *reportDayDuelDo {
- return r.withDO(r.DO.Join(table, on...))
- }
- func (r reportDayDuelDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayDuelDo {
- return r.withDO(r.DO.LeftJoin(table, on...))
- }
- func (r reportDayDuelDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayDuelDo {
- return r.withDO(r.DO.RightJoin(table, on...))
- }
- func (r reportDayDuelDo) Group(cols ...field.Expr) *reportDayDuelDo {
- return r.withDO(r.DO.Group(cols...))
- }
- func (r reportDayDuelDo) Having(conds ...gen.Condition) *reportDayDuelDo {
- return r.withDO(r.DO.Having(conds...))
- }
- func (r reportDayDuelDo) Limit(limit int) *reportDayDuelDo {
- return r.withDO(r.DO.Limit(limit))
- }
- func (r reportDayDuelDo) Offset(offset int) *reportDayDuelDo {
- return r.withDO(r.DO.Offset(offset))
- }
- func (r reportDayDuelDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayDuelDo {
- return r.withDO(r.DO.Scopes(funcs...))
- }
- func (r reportDayDuelDo) Unscoped() *reportDayDuelDo {
- return r.withDO(r.DO.Unscoped())
- }
- func (r reportDayDuelDo) Create(values ...*model.ReportDayDuel) error {
- if len(values) == 0 {
- return nil
- }
- return r.DO.Create(values)
- }
- func (r reportDayDuelDo) CreateInBatches(values []*model.ReportDayDuel, 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 reportDayDuelDo) Save(values ...*model.ReportDayDuel) error {
- if len(values) == 0 {
- return nil
- }
- return r.DO.Save(values)
- }
- func (r reportDayDuelDo) First() (*model.ReportDayDuel, error) {
- if result, err := r.DO.First(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayDuel), nil
- }
- }
- func (r reportDayDuelDo) Take() (*model.ReportDayDuel, error) {
- if result, err := r.DO.Take(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayDuel), nil
- }
- }
- func (r reportDayDuelDo) Last() (*model.ReportDayDuel, error) {
- if result, err := r.DO.Last(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayDuel), nil
- }
- }
- func (r reportDayDuelDo) Find() ([]*model.ReportDayDuel, error) {
- result, err := r.DO.Find()
- return result.([]*model.ReportDayDuel), err
- }
- func (r reportDayDuelDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayDuel, err error) {
- buf := make([]*model.ReportDayDuel, 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 reportDayDuelDo) FindInBatches(result *[]*model.ReportDayDuel, batchSize int, fc func(tx gen.Dao, batch int) error) error {
- return r.DO.FindInBatches(result, batchSize, fc)
- }
- func (r reportDayDuelDo) Attrs(attrs ...field.AssignExpr) *reportDayDuelDo {
- return r.withDO(r.DO.Attrs(attrs...))
- }
- func (r reportDayDuelDo) Assign(attrs ...field.AssignExpr) *reportDayDuelDo {
- return r.withDO(r.DO.Assign(attrs...))
- }
- func (r reportDayDuelDo) Joins(fields ...field.RelationField) *reportDayDuelDo {
- for _, _f := range fields {
- r = *r.withDO(r.DO.Joins(_f))
- }
- return &r
- }
- func (r reportDayDuelDo) Preload(fields ...field.RelationField) *reportDayDuelDo {
- for _, _f := range fields {
- r = *r.withDO(r.DO.Preload(_f))
- }
- return &r
- }
- func (r reportDayDuelDo) FirstOrInit() (*model.ReportDayDuel, error) {
- if result, err := r.DO.FirstOrInit(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayDuel), nil
- }
- }
- func (r reportDayDuelDo) FirstOrCreate() (*model.ReportDayDuel, error) {
- if result, err := r.DO.FirstOrCreate(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayDuel), nil
- }
- }
- func (r reportDayDuelDo) FindByPage(offset int, limit int) (result []*model.ReportDayDuel, 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 reportDayDuelDo) 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 reportDayDuelDo) Scan(result interface{}) (err error) {
- return r.DO.Scan(result)
- }
- func (r reportDayDuelDo) Delete(models ...*model.ReportDayDuel) (result gen.ResultInfo, err error) {
- return r.DO.Delete(models)
- }
- func (r *reportDayDuelDo) withDO(do gen.Dao) *reportDayDuelDo {
- r.DO = *do.(*gen.DO)
- return r
- }
|