// 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 newReportDayTreasureChest(db *gorm.DB, opts ...gen.DOOption) reportDayTreasureChest { _reportDayTreasureChest := reportDayTreasureChest{} _reportDayTreasureChest.reportDayTreasureChestDo.UseDB(db, opts...) _reportDayTreasureChest.reportDayTreasureChestDo.UseModel(&model.ReportDayTreasureChest{}) tableName := _reportDayTreasureChest.reportDayTreasureChestDo.TableName() _reportDayTreasureChest.ALL = field.NewAsterisk(tableName) _reportDayTreasureChest.ID = field.NewInt64(tableName, "id") _reportDayTreasureChest.Date = field.NewString(tableName, "date") _reportDayTreasureChest.ServerID = field.NewInt32(tableName, "server_id") _reportDayTreasureChest.PlayerCountHuangjin = field.NewInt64(tableName, "player_count_huangjin") _reportDayTreasureChest.PlayerCountBaiyin = field.NewInt64(tableName, "player_count_baiyin") _reportDayTreasureChest.OpenCountHuangjin = field.NewInt64(tableName, "open_count_huangjin") _reportDayTreasureChest.OpenCountBaiyin = field.NewInt64(tableName, "open_count_baiyin") _reportDayTreasureChest.fillFieldMap() return _reportDayTreasureChest } type reportDayTreasureChest struct { reportDayTreasureChestDo ALL field.Asterisk ID field.Int64 // ID Date field.String // 日期 ServerID field.Int32 // 服务器ID PlayerCountHuangjin field.Int64 // 黄金参与人数 PlayerCountBaiyin field.Int64 // 白银参与人数 OpenCountHuangjin field.Int64 // 黄金开启宝箱数量 OpenCountBaiyin field.Int64 // 白银开启宝箱数量 fieldMap map[string]field.Expr } func (r reportDayTreasureChest) Table(newTableName string) *reportDayTreasureChest { r.reportDayTreasureChestDo.UseTable(newTableName) return r.updateTableName(newTableName) } func (r reportDayTreasureChest) As(alias string) *reportDayTreasureChest { r.reportDayTreasureChestDo.DO = *(r.reportDayTreasureChestDo.As(alias).(*gen.DO)) return r.updateTableName(alias) } func (r *reportDayTreasureChest) updateTableName(table string) *reportDayTreasureChest { r.ALL = field.NewAsterisk(table) r.ID = field.NewInt64(table, "id") r.Date = field.NewString(table, "date") r.ServerID = field.NewInt32(table, "server_id") r.PlayerCountHuangjin = field.NewInt64(table, "player_count_huangjin") r.PlayerCountBaiyin = field.NewInt64(table, "player_count_baiyin") r.OpenCountHuangjin = field.NewInt64(table, "open_count_huangjin") r.OpenCountBaiyin = field.NewInt64(table, "open_count_baiyin") r.fillFieldMap() return r } func (r *reportDayTreasureChest) 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 *reportDayTreasureChest) fillFieldMap() { r.fieldMap = make(map[string]field.Expr, 7) r.fieldMap["id"] = r.ID r.fieldMap["date"] = r.Date r.fieldMap["server_id"] = r.ServerID r.fieldMap["player_count_huangjin"] = r.PlayerCountHuangjin r.fieldMap["player_count_baiyin"] = r.PlayerCountBaiyin r.fieldMap["open_count_huangjin"] = r.OpenCountHuangjin r.fieldMap["open_count_baiyin"] = r.OpenCountBaiyin } func (r reportDayTreasureChest) clone(db *gorm.DB) reportDayTreasureChest { r.reportDayTreasureChestDo.ReplaceConnPool(db.Statement.ConnPool) return r } func (r reportDayTreasureChest) replaceDB(db *gorm.DB) reportDayTreasureChest { r.reportDayTreasureChestDo.ReplaceDB(db) return r } type reportDayTreasureChestDo struct{ gen.DO } func (r reportDayTreasureChestDo) Debug() *reportDayTreasureChestDo { return r.withDO(r.DO.Debug()) } func (r reportDayTreasureChestDo) WithContext(ctx context.Context) *reportDayTreasureChestDo { return r.withDO(r.DO.WithContext(ctx)) } func (r reportDayTreasureChestDo) ReadDB() *reportDayTreasureChestDo { return r.Clauses(dbresolver.Read) } func (r reportDayTreasureChestDo) WriteDB() *reportDayTreasureChestDo { return r.Clauses(dbresolver.Write) } func (r reportDayTreasureChestDo) Session(config *gorm.Session) *reportDayTreasureChestDo { return r.withDO(r.DO.Session(config)) } func (r reportDayTreasureChestDo) Clauses(conds ...clause.Expression) *reportDayTreasureChestDo { return r.withDO(r.DO.Clauses(conds...)) } func (r reportDayTreasureChestDo) Returning(value interface{}, columns ...string) *reportDayTreasureChestDo { return r.withDO(r.DO.Returning(value, columns...)) } func (r reportDayTreasureChestDo) Not(conds ...gen.Condition) *reportDayTreasureChestDo { return r.withDO(r.DO.Not(conds...)) } func (r reportDayTreasureChestDo) Or(conds ...gen.Condition) *reportDayTreasureChestDo { return r.withDO(r.DO.Or(conds...)) } func (r reportDayTreasureChestDo) Select(conds ...field.Expr) *reportDayTreasureChestDo { return r.withDO(r.DO.Select(conds...)) } func (r reportDayTreasureChestDo) Where(conds ...gen.Condition) *reportDayTreasureChestDo { return r.withDO(r.DO.Where(conds...)) } func (r reportDayTreasureChestDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayTreasureChestDo { return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (r reportDayTreasureChestDo) Order(conds ...field.Expr) *reportDayTreasureChestDo { return r.withDO(r.DO.Order(conds...)) } func (r reportDayTreasureChestDo) Distinct(cols ...field.Expr) *reportDayTreasureChestDo { return r.withDO(r.DO.Distinct(cols...)) } func (r reportDayTreasureChestDo) Omit(cols ...field.Expr) *reportDayTreasureChestDo { return r.withDO(r.DO.Omit(cols...)) } func (r reportDayTreasureChestDo) Join(table schema.Tabler, on ...field.Expr) *reportDayTreasureChestDo { return r.withDO(r.DO.Join(table, on...)) } func (r reportDayTreasureChestDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayTreasureChestDo { return r.withDO(r.DO.LeftJoin(table, on...)) } func (r reportDayTreasureChestDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayTreasureChestDo { return r.withDO(r.DO.RightJoin(table, on...)) } func (r reportDayTreasureChestDo) Group(cols ...field.Expr) *reportDayTreasureChestDo { return r.withDO(r.DO.Group(cols...)) } func (r reportDayTreasureChestDo) Having(conds ...gen.Condition) *reportDayTreasureChestDo { return r.withDO(r.DO.Having(conds...)) } func (r reportDayTreasureChestDo) Limit(limit int) *reportDayTreasureChestDo { return r.withDO(r.DO.Limit(limit)) } func (r reportDayTreasureChestDo) Offset(offset int) *reportDayTreasureChestDo { return r.withDO(r.DO.Offset(offset)) } func (r reportDayTreasureChestDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayTreasureChestDo { return r.withDO(r.DO.Scopes(funcs...)) } func (r reportDayTreasureChestDo) Unscoped() *reportDayTreasureChestDo { return r.withDO(r.DO.Unscoped()) } func (r reportDayTreasureChestDo) Create(values ...*model.ReportDayTreasureChest) error { if len(values) == 0 { return nil } return r.DO.Create(values) } func (r reportDayTreasureChestDo) CreateInBatches(values []*model.ReportDayTreasureChest, 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 reportDayTreasureChestDo) Save(values ...*model.ReportDayTreasureChest) error { if len(values) == 0 { return nil } return r.DO.Save(values) } func (r reportDayTreasureChestDo) First() (*model.ReportDayTreasureChest, error) { if result, err := r.DO.First(); err != nil { return nil, err } else { return result.(*model.ReportDayTreasureChest), nil } } func (r reportDayTreasureChestDo) Take() (*model.ReportDayTreasureChest, error) { if result, err := r.DO.Take(); err != nil { return nil, err } else { return result.(*model.ReportDayTreasureChest), nil } } func (r reportDayTreasureChestDo) Last() (*model.ReportDayTreasureChest, error) { if result, err := r.DO.Last(); err != nil { return nil, err } else { return result.(*model.ReportDayTreasureChest), nil } } func (r reportDayTreasureChestDo) Find() ([]*model.ReportDayTreasureChest, error) { result, err := r.DO.Find() return result.([]*model.ReportDayTreasureChest), err } func (r reportDayTreasureChestDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayTreasureChest, err error) { buf := make([]*model.ReportDayTreasureChest, 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 reportDayTreasureChestDo) FindInBatches(result *[]*model.ReportDayTreasureChest, batchSize int, fc func(tx gen.Dao, batch int) error) error { return r.DO.FindInBatches(result, batchSize, fc) } func (r reportDayTreasureChestDo) Attrs(attrs ...field.AssignExpr) *reportDayTreasureChestDo { return r.withDO(r.DO.Attrs(attrs...)) } func (r reportDayTreasureChestDo) Assign(attrs ...field.AssignExpr) *reportDayTreasureChestDo { return r.withDO(r.DO.Assign(attrs...)) } func (r reportDayTreasureChestDo) Joins(fields ...field.RelationField) *reportDayTreasureChestDo { for _, _f := range fields { r = *r.withDO(r.DO.Joins(_f)) } return &r } func (r reportDayTreasureChestDo) Preload(fields ...field.RelationField) *reportDayTreasureChestDo { for _, _f := range fields { r = *r.withDO(r.DO.Preload(_f)) } return &r } func (r reportDayTreasureChestDo) FirstOrInit() (*model.ReportDayTreasureChest, error) { if result, err := r.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.ReportDayTreasureChest), nil } } func (r reportDayTreasureChestDo) FirstOrCreate() (*model.ReportDayTreasureChest, error) { if result, err := r.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.ReportDayTreasureChest), nil } } func (r reportDayTreasureChestDo) FindByPage(offset int, limit int) (result []*model.ReportDayTreasureChest, 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 reportDayTreasureChestDo) 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 reportDayTreasureChestDo) Scan(result interface{}) (err error) { return r.DO.Scan(result) } func (r reportDayTreasureChestDo) Delete(models ...*model.ReportDayTreasureChest) (result gen.ResultInfo, err error) { return r.DO.Delete(models) } func (r *reportDayTreasureChestDo) withDO(do gen.Dao) *reportDayTreasureChestDo { r.DO = *do.(*gen.DO) return r }