// 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 newReportDayExpedition(db *gorm.DB, opts ...gen.DOOption) reportDayExpedition { _reportDayExpedition := reportDayExpedition{} _reportDayExpedition.reportDayExpeditionDo.UseDB(db, opts...) _reportDayExpedition.reportDayExpeditionDo.UseModel(&model.ReportDayExpedition{}) tableName := _reportDayExpedition.reportDayExpeditionDo.TableName() _reportDayExpedition.ALL = field.NewAsterisk(tableName) _reportDayExpedition.ID = field.NewInt64(tableName, "id") _reportDayExpedition.Date = field.NewString(tableName, "date") _reportDayExpedition.ChannelID = field.NewString(tableName, "channel_id") _reportDayExpedition.ServerID = field.NewInt32(tableName, "server_id") _reportDayExpedition.PlayerCount = field.NewInt64(tableName, "player_count") _reportDayExpedition.BreakCount = field.NewInt64(tableName, "break_count") _reportDayExpedition.FailData = field.NewString(tableName, "fail_data") _reportDayExpedition.SweepCount = field.NewInt64(tableName, "sweep_count") _reportDayExpedition.StarsAdvCount = field.NewInt64(tableName, "stars_adv_count") _reportDayExpedition.StarsDrillCount = field.NewInt64(tableName, "stars_drill_count") _reportDayExpedition.OutputData = field.NewString(tableName, "output_data") _reportDayExpedition.fillFieldMap() return _reportDayExpedition } type reportDayExpedition struct { reportDayExpeditionDo ALL field.Asterisk ID field.Int64 // ID Date field.String // 日期 ChannelID field.String // 渠道ID ServerID field.Int32 // 服务器ID PlayerCount field.Int64 // 参与人数 BreakCount field.Int64 // 闯关次数 FailData field.String // 闯关失败列表 SweepCount field.Int64 // 扫荡次数 StarsAdvCount field.Int64 // 看广告获取星石次数 StarsDrillCount field.Int64 // 钻石购买获得星石次数 OutputData field.String // 产出物品和数量 fieldMap map[string]field.Expr } func (r reportDayExpedition) Table(newTableName string) *reportDayExpedition { r.reportDayExpeditionDo.UseTable(newTableName) return r.updateTableName(newTableName) } func (r reportDayExpedition) As(alias string) *reportDayExpedition { r.reportDayExpeditionDo.DO = *(r.reportDayExpeditionDo.As(alias).(*gen.DO)) return r.updateTableName(alias) } func (r *reportDayExpedition) updateTableName(table string) *reportDayExpedition { 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.FailData = field.NewString(table, "fail_data") r.SweepCount = field.NewInt64(table, "sweep_count") r.StarsAdvCount = field.NewInt64(table, "stars_adv_count") r.StarsDrillCount = field.NewInt64(table, "stars_drill_count") r.OutputData = field.NewString(table, "output_data") r.fillFieldMap() return r } func (r *reportDayExpedition) 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 *reportDayExpedition) fillFieldMap() { r.fieldMap = make(map[string]field.Expr, 11) 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["fail_data"] = r.FailData r.fieldMap["sweep_count"] = r.SweepCount r.fieldMap["stars_adv_count"] = r.StarsAdvCount r.fieldMap["stars_drill_count"] = r.StarsDrillCount r.fieldMap["output_data"] = r.OutputData } func (r reportDayExpedition) clone(db *gorm.DB) reportDayExpedition { r.reportDayExpeditionDo.ReplaceConnPool(db.Statement.ConnPool) return r } func (r reportDayExpedition) replaceDB(db *gorm.DB) reportDayExpedition { r.reportDayExpeditionDo.ReplaceDB(db) return r } type reportDayExpeditionDo struct{ gen.DO } func (r reportDayExpeditionDo) Debug() *reportDayExpeditionDo { return r.withDO(r.DO.Debug()) } func (r reportDayExpeditionDo) WithContext(ctx context.Context) *reportDayExpeditionDo { return r.withDO(r.DO.WithContext(ctx)) } func (r reportDayExpeditionDo) ReadDB() *reportDayExpeditionDo { return r.Clauses(dbresolver.Read) } func (r reportDayExpeditionDo) WriteDB() *reportDayExpeditionDo { return r.Clauses(dbresolver.Write) } func (r reportDayExpeditionDo) Session(config *gorm.Session) *reportDayExpeditionDo { return r.withDO(r.DO.Session(config)) } func (r reportDayExpeditionDo) Clauses(conds ...clause.Expression) *reportDayExpeditionDo { return r.withDO(r.DO.Clauses(conds...)) } func (r reportDayExpeditionDo) Returning(value interface{}, columns ...string) *reportDayExpeditionDo { return r.withDO(r.DO.Returning(value, columns...)) } func (r reportDayExpeditionDo) Not(conds ...gen.Condition) *reportDayExpeditionDo { return r.withDO(r.DO.Not(conds...)) } func (r reportDayExpeditionDo) Or(conds ...gen.Condition) *reportDayExpeditionDo { return r.withDO(r.DO.Or(conds...)) } func (r reportDayExpeditionDo) Select(conds ...field.Expr) *reportDayExpeditionDo { return r.withDO(r.DO.Select(conds...)) } func (r reportDayExpeditionDo) Where(conds ...gen.Condition) *reportDayExpeditionDo { return r.withDO(r.DO.Where(conds...)) } func (r reportDayExpeditionDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayExpeditionDo { return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (r reportDayExpeditionDo) Order(conds ...field.Expr) *reportDayExpeditionDo { return r.withDO(r.DO.Order(conds...)) } func (r reportDayExpeditionDo) Distinct(cols ...field.Expr) *reportDayExpeditionDo { return r.withDO(r.DO.Distinct(cols...)) } func (r reportDayExpeditionDo) Omit(cols ...field.Expr) *reportDayExpeditionDo { return r.withDO(r.DO.Omit(cols...)) } func (r reportDayExpeditionDo) Join(table schema.Tabler, on ...field.Expr) *reportDayExpeditionDo { return r.withDO(r.DO.Join(table, on...)) } func (r reportDayExpeditionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayExpeditionDo { return r.withDO(r.DO.LeftJoin(table, on...)) } func (r reportDayExpeditionDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayExpeditionDo { return r.withDO(r.DO.RightJoin(table, on...)) } func (r reportDayExpeditionDo) Group(cols ...field.Expr) *reportDayExpeditionDo { return r.withDO(r.DO.Group(cols...)) } func (r reportDayExpeditionDo) Having(conds ...gen.Condition) *reportDayExpeditionDo { return r.withDO(r.DO.Having(conds...)) } func (r reportDayExpeditionDo) Limit(limit int) *reportDayExpeditionDo { return r.withDO(r.DO.Limit(limit)) } func (r reportDayExpeditionDo) Offset(offset int) *reportDayExpeditionDo { return r.withDO(r.DO.Offset(offset)) } func (r reportDayExpeditionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayExpeditionDo { return r.withDO(r.DO.Scopes(funcs...)) } func (r reportDayExpeditionDo) Unscoped() *reportDayExpeditionDo { return r.withDO(r.DO.Unscoped()) } func (r reportDayExpeditionDo) Create(values ...*model.ReportDayExpedition) error { if len(values) == 0 { return nil } return r.DO.Create(values) } func (r reportDayExpeditionDo) CreateInBatches(values []*model.ReportDayExpedition, 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 reportDayExpeditionDo) Save(values ...*model.ReportDayExpedition) error { if len(values) == 0 { return nil } return r.DO.Save(values) } func (r reportDayExpeditionDo) First() (*model.ReportDayExpedition, error) { if result, err := r.DO.First(); err != nil { return nil, err } else { return result.(*model.ReportDayExpedition), nil } } func (r reportDayExpeditionDo) Take() (*model.ReportDayExpedition, error) { if result, err := r.DO.Take(); err != nil { return nil, err } else { return result.(*model.ReportDayExpedition), nil } } func (r reportDayExpeditionDo) Last() (*model.ReportDayExpedition, error) { if result, err := r.DO.Last(); err != nil { return nil, err } else { return result.(*model.ReportDayExpedition), nil } } func (r reportDayExpeditionDo) Find() ([]*model.ReportDayExpedition, error) { result, err := r.DO.Find() return result.([]*model.ReportDayExpedition), err } func (r reportDayExpeditionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayExpedition, err error) { buf := make([]*model.ReportDayExpedition, 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 reportDayExpeditionDo) FindInBatches(result *[]*model.ReportDayExpedition, batchSize int, fc func(tx gen.Dao, batch int) error) error { return r.DO.FindInBatches(result, batchSize, fc) } func (r reportDayExpeditionDo) Attrs(attrs ...field.AssignExpr) *reportDayExpeditionDo { return r.withDO(r.DO.Attrs(attrs...)) } func (r reportDayExpeditionDo) Assign(attrs ...field.AssignExpr) *reportDayExpeditionDo { return r.withDO(r.DO.Assign(attrs...)) } func (r reportDayExpeditionDo) Joins(fields ...field.RelationField) *reportDayExpeditionDo { for _, _f := range fields { r = *r.withDO(r.DO.Joins(_f)) } return &r } func (r reportDayExpeditionDo) Preload(fields ...field.RelationField) *reportDayExpeditionDo { for _, _f := range fields { r = *r.withDO(r.DO.Preload(_f)) } return &r } func (r reportDayExpeditionDo) FirstOrInit() (*model.ReportDayExpedition, error) { if result, err := r.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.ReportDayExpedition), nil } } func (r reportDayExpeditionDo) FirstOrCreate() (*model.ReportDayExpedition, error) { if result, err := r.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.ReportDayExpedition), nil } } func (r reportDayExpeditionDo) FindByPage(offset int, limit int) (result []*model.ReportDayExpedition, 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 reportDayExpeditionDo) 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 reportDayExpeditionDo) Scan(result interface{}) (err error) { return r.DO.Scan(result) } func (r reportDayExpeditionDo) Delete(models ...*model.ReportDayExpedition) (result gen.ResultInfo, err error) { return r.DO.Delete(models) } func (r *reportDayExpeditionDo) withDO(do gen.Dao) *reportDayExpeditionDo { r.DO = *do.(*gen.DO) return r }