123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- // 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 newReportDayBoss(db *gorm.DB, opts ...gen.DOOption) reportDayBoss {
- _reportDayBoss := reportDayBoss{}
- _reportDayBoss.reportDayBossDo.UseDB(db, opts...)
- _reportDayBoss.reportDayBossDo.UseModel(&model.ReportDayBoss{})
- tableName := _reportDayBoss.reportDayBossDo.TableName()
- _reportDayBoss.ALL = field.NewAsterisk(tableName)
- _reportDayBoss.ID = field.NewInt64(tableName, "id")
- _reportDayBoss.Date = field.NewString(tableName, "date")
- _reportDayBoss.ChannelID = field.NewString(tableName, "channel_id")
- _reportDayBoss.ServerID = field.NewInt32(tableName, "server_id")
- _reportDayBoss.PlayerCount = field.NewInt64(tableName, "player_count")
- _reportDayBoss.ChallengeCount = field.NewInt64(tableName, "challenge_count")
- _reportDayBoss.MaxStage = field.NewInt64(tableName, "max_stage")
- _reportDayBoss.ReviveCount = field.NewInt64(tableName, "revive_count")
- _reportDayBoss.ExchangeData = field.NewString(tableName, "exchange_data")
- _reportDayBoss.RepelCount = field.NewInt32(tableName, "repel_count")
- _reportDayBoss.AwardCount = field.NewInt32(tableName, "award_count")
- _reportDayBoss.MinuteMix1 = field.NewInt64(tableName, "minute_mix1")
- _reportDayBoss.MinuteMix2 = field.NewInt64(tableName, "minute_mix2")
- _reportDayBoss.MinuteMix3 = field.NewInt64(tableName, "minute_mix3")
- _reportDayBoss.TotalMinute = field.NewInt64(tableName, "total_minute")
- _reportDayBoss.fillFieldMap()
- return _reportDayBoss
- }
- type reportDayBoss struct {
- reportDayBossDo
- ALL field.Asterisk
- ID field.Int64 // ID
- Date field.String // 日期
- ChannelID field.String // 渠道ID
- ServerID field.Int32 // 服务器ID
- PlayerCount field.Int64 // 参与人数
- ChallengeCount field.Int64 // 总挑战次数
- MaxStage field.Int64 // 最大击退阶段
- ReviveCount field.Int64 // 复活次数
- ExchangeData field.String // {领取档位:数量}
- RepelCount field.Int32 // 查看击退奖励次数
- AwardCount field.Int32 // 查看排行榜奖励次数
- MinuteMix1 field.Int64 // 0~1分钟人数
- MinuteMix2 field.Int64 // 1~2分钟人数
- MinuteMix3 field.Int64 // 2分钟以上人数
- TotalMinute field.Int64 // 累计时长
- fieldMap map[string]field.Expr
- }
- func (r reportDayBoss) Table(newTableName string) *reportDayBoss {
- r.reportDayBossDo.UseTable(newTableName)
- return r.updateTableName(newTableName)
- }
- func (r reportDayBoss) As(alias string) *reportDayBoss {
- r.reportDayBossDo.DO = *(r.reportDayBossDo.As(alias).(*gen.DO))
- return r.updateTableName(alias)
- }
- func (r *reportDayBoss) updateTableName(table string) *reportDayBoss {
- 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.ChallengeCount = field.NewInt64(table, "challenge_count")
- r.MaxStage = field.NewInt64(table, "max_stage")
- r.ReviveCount = field.NewInt64(table, "revive_count")
- r.ExchangeData = field.NewString(table, "exchange_data")
- r.RepelCount = field.NewInt32(table, "repel_count")
- r.AwardCount = field.NewInt32(table, "award_count")
- r.MinuteMix1 = field.NewInt64(table, "minute_mix1")
- r.MinuteMix2 = field.NewInt64(table, "minute_mix2")
- r.MinuteMix3 = field.NewInt64(table, "minute_mix3")
- r.TotalMinute = field.NewInt64(table, "total_minute")
- r.fillFieldMap()
- return r
- }
- func (r *reportDayBoss) 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 *reportDayBoss) fillFieldMap() {
- r.fieldMap = make(map[string]field.Expr, 15)
- 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["challenge_count"] = r.ChallengeCount
- r.fieldMap["max_stage"] = r.MaxStage
- r.fieldMap["revive_count"] = r.ReviveCount
- r.fieldMap["exchange_data"] = r.ExchangeData
- r.fieldMap["repel_count"] = r.RepelCount
- r.fieldMap["award_count"] = r.AwardCount
- r.fieldMap["minute_mix1"] = r.MinuteMix1
- r.fieldMap["minute_mix2"] = r.MinuteMix2
- r.fieldMap["minute_mix3"] = r.MinuteMix3
- r.fieldMap["total_minute"] = r.TotalMinute
- }
- func (r reportDayBoss) clone(db *gorm.DB) reportDayBoss {
- r.reportDayBossDo.ReplaceConnPool(db.Statement.ConnPool)
- return r
- }
- func (r reportDayBoss) replaceDB(db *gorm.DB) reportDayBoss {
- r.reportDayBossDo.ReplaceDB(db)
- return r
- }
- type reportDayBossDo struct{ gen.DO }
- func (r reportDayBossDo) Debug() *reportDayBossDo {
- return r.withDO(r.DO.Debug())
- }
- func (r reportDayBossDo) WithContext(ctx context.Context) *reportDayBossDo {
- return r.withDO(r.DO.WithContext(ctx))
- }
- func (r reportDayBossDo) ReadDB() *reportDayBossDo {
- return r.Clauses(dbresolver.Read)
- }
- func (r reportDayBossDo) WriteDB() *reportDayBossDo {
- return r.Clauses(dbresolver.Write)
- }
- func (r reportDayBossDo) Session(config *gorm.Session) *reportDayBossDo {
- return r.withDO(r.DO.Session(config))
- }
- func (r reportDayBossDo) Clauses(conds ...clause.Expression) *reportDayBossDo {
- return r.withDO(r.DO.Clauses(conds...))
- }
- func (r reportDayBossDo) Returning(value interface{}, columns ...string) *reportDayBossDo {
- return r.withDO(r.DO.Returning(value, columns...))
- }
- func (r reportDayBossDo) Not(conds ...gen.Condition) *reportDayBossDo {
- return r.withDO(r.DO.Not(conds...))
- }
- func (r reportDayBossDo) Or(conds ...gen.Condition) *reportDayBossDo {
- return r.withDO(r.DO.Or(conds...))
- }
- func (r reportDayBossDo) Select(conds ...field.Expr) *reportDayBossDo {
- return r.withDO(r.DO.Select(conds...))
- }
- func (r reportDayBossDo) Where(conds ...gen.Condition) *reportDayBossDo {
- return r.withDO(r.DO.Where(conds...))
- }
- func (r reportDayBossDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayBossDo {
- return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
- }
- func (r reportDayBossDo) Order(conds ...field.Expr) *reportDayBossDo {
- return r.withDO(r.DO.Order(conds...))
- }
- func (r reportDayBossDo) Distinct(cols ...field.Expr) *reportDayBossDo {
- return r.withDO(r.DO.Distinct(cols...))
- }
- func (r reportDayBossDo) Omit(cols ...field.Expr) *reportDayBossDo {
- return r.withDO(r.DO.Omit(cols...))
- }
- func (r reportDayBossDo) Join(table schema.Tabler, on ...field.Expr) *reportDayBossDo {
- return r.withDO(r.DO.Join(table, on...))
- }
- func (r reportDayBossDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayBossDo {
- return r.withDO(r.DO.LeftJoin(table, on...))
- }
- func (r reportDayBossDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayBossDo {
- return r.withDO(r.DO.RightJoin(table, on...))
- }
- func (r reportDayBossDo) Group(cols ...field.Expr) *reportDayBossDo {
- return r.withDO(r.DO.Group(cols...))
- }
- func (r reportDayBossDo) Having(conds ...gen.Condition) *reportDayBossDo {
- return r.withDO(r.DO.Having(conds...))
- }
- func (r reportDayBossDo) Limit(limit int) *reportDayBossDo {
- return r.withDO(r.DO.Limit(limit))
- }
- func (r reportDayBossDo) Offset(offset int) *reportDayBossDo {
- return r.withDO(r.DO.Offset(offset))
- }
- func (r reportDayBossDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayBossDo {
- return r.withDO(r.DO.Scopes(funcs...))
- }
- func (r reportDayBossDo) Unscoped() *reportDayBossDo {
- return r.withDO(r.DO.Unscoped())
- }
- func (r reportDayBossDo) Create(values ...*model.ReportDayBoss) error {
- if len(values) == 0 {
- return nil
- }
- return r.DO.Create(values)
- }
- func (r reportDayBossDo) CreateInBatches(values []*model.ReportDayBoss, 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 reportDayBossDo) Save(values ...*model.ReportDayBoss) error {
- if len(values) == 0 {
- return nil
- }
- return r.DO.Save(values)
- }
- func (r reportDayBossDo) First() (*model.ReportDayBoss, error) {
- if result, err := r.DO.First(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayBoss), nil
- }
- }
- func (r reportDayBossDo) Take() (*model.ReportDayBoss, error) {
- if result, err := r.DO.Take(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayBoss), nil
- }
- }
- func (r reportDayBossDo) Last() (*model.ReportDayBoss, error) {
- if result, err := r.DO.Last(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayBoss), nil
- }
- }
- func (r reportDayBossDo) Find() ([]*model.ReportDayBoss, error) {
- result, err := r.DO.Find()
- return result.([]*model.ReportDayBoss), err
- }
- func (r reportDayBossDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayBoss, err error) {
- buf := make([]*model.ReportDayBoss, 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 reportDayBossDo) FindInBatches(result *[]*model.ReportDayBoss, batchSize int, fc func(tx gen.Dao, batch int) error) error {
- return r.DO.FindInBatches(result, batchSize, fc)
- }
- func (r reportDayBossDo) Attrs(attrs ...field.AssignExpr) *reportDayBossDo {
- return r.withDO(r.DO.Attrs(attrs...))
- }
- func (r reportDayBossDo) Assign(attrs ...field.AssignExpr) *reportDayBossDo {
- return r.withDO(r.DO.Assign(attrs...))
- }
- func (r reportDayBossDo) Joins(fields ...field.RelationField) *reportDayBossDo {
- for _, _f := range fields {
- r = *r.withDO(r.DO.Joins(_f))
- }
- return &r
- }
- func (r reportDayBossDo) Preload(fields ...field.RelationField) *reportDayBossDo {
- for _, _f := range fields {
- r = *r.withDO(r.DO.Preload(_f))
- }
- return &r
- }
- func (r reportDayBossDo) FirstOrInit() (*model.ReportDayBoss, error) {
- if result, err := r.DO.FirstOrInit(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayBoss), nil
- }
- }
- func (r reportDayBossDo) FirstOrCreate() (*model.ReportDayBoss, error) {
- if result, err := r.DO.FirstOrCreate(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayBoss), nil
- }
- }
- func (r reportDayBossDo) FindByPage(offset int, limit int) (result []*model.ReportDayBoss, 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 reportDayBossDo) 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 reportDayBossDo) Scan(result interface{}) (err error) {
- return r.DO.Scan(result)
- }
- func (r reportDayBossDo) Delete(models ...*model.ReportDayBoss) (result gen.ResultInfo, err error) {
- return r.DO.Delete(models)
- }
- func (r *reportDayBossDo) withDO(do gen.Dao) *reportDayBossDo {
- r.DO = *do.(*gen.DO)
- return r
- }
|