// 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 newReportLevelOutput(db *gorm.DB, opts ...gen.DOOption) reportLevelOutput { _reportLevelOutput := reportLevelOutput{} _reportLevelOutput.reportLevelOutputDo.UseDB(db, opts...) _reportLevelOutput.reportLevelOutputDo.UseModel(&model.ReportLevelOutput{}) tableName := _reportLevelOutput.reportLevelOutputDo.TableName() _reportLevelOutput.ALL = field.NewAsterisk(tableName) _reportLevelOutput.ID = field.NewInt64(tableName, "id") _reportLevelOutput.Level = field.NewInt64(tableName, "level") _reportLevelOutput.ChannelID = field.NewString(tableName, "channel_id") _reportLevelOutput.ServerID = field.NewInt32(tableName, "server_id") _reportLevelOutput.Coin = field.NewInt64(tableName, "coin") _reportLevelOutput.Diamond = field.NewInt64(tableName, "diamond") _reportLevelOutput.fillFieldMap() return _reportLevelOutput } type reportLevelOutput struct { reportLevelOutputDo ALL field.Asterisk ID field.Int64 // ID Level field.Int64 ChannelID field.String // 渠道ID ServerID field.Int32 // 服务器ID Coin field.Int64 // 金币 Diamond field.Int64 // 钻石 fieldMap map[string]field.Expr } func (r reportLevelOutput) Table(newTableName string) *reportLevelOutput { r.reportLevelOutputDo.UseTable(newTableName) return r.updateTableName(newTableName) } func (r reportLevelOutput) As(alias string) *reportLevelOutput { r.reportLevelOutputDo.DO = *(r.reportLevelOutputDo.As(alias).(*gen.DO)) return r.updateTableName(alias) } func (r *reportLevelOutput) updateTableName(table string) *reportLevelOutput { r.ALL = field.NewAsterisk(table) r.ID = field.NewInt64(table, "id") r.Level = field.NewInt64(table, "level") r.ChannelID = field.NewString(table, "channel_id") r.ServerID = field.NewInt32(table, "server_id") r.Coin = field.NewInt64(table, "coin") r.Diamond = field.NewInt64(table, "diamond") r.fillFieldMap() return r } func (r *reportLevelOutput) 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 *reportLevelOutput) fillFieldMap() { r.fieldMap = make(map[string]field.Expr, 6) r.fieldMap["id"] = r.ID r.fieldMap["level"] = r.Level r.fieldMap["channel_id"] = r.ChannelID r.fieldMap["server_id"] = r.ServerID r.fieldMap["coin"] = r.Coin r.fieldMap["diamond"] = r.Diamond } func (r reportLevelOutput) clone(db *gorm.DB) reportLevelOutput { r.reportLevelOutputDo.ReplaceConnPool(db.Statement.ConnPool) return r } func (r reportLevelOutput) replaceDB(db *gorm.DB) reportLevelOutput { r.reportLevelOutputDo.ReplaceDB(db) return r } type reportLevelOutputDo struct{ gen.DO } func (r reportLevelOutputDo) Debug() *reportLevelOutputDo { return r.withDO(r.DO.Debug()) } func (r reportLevelOutputDo) WithContext(ctx context.Context) *reportLevelOutputDo { return r.withDO(r.DO.WithContext(ctx)) } func (r reportLevelOutputDo) ReadDB() *reportLevelOutputDo { return r.Clauses(dbresolver.Read) } func (r reportLevelOutputDo) WriteDB() *reportLevelOutputDo { return r.Clauses(dbresolver.Write) } func (r reportLevelOutputDo) Session(config *gorm.Session) *reportLevelOutputDo { return r.withDO(r.DO.Session(config)) } func (r reportLevelOutputDo) Clauses(conds ...clause.Expression) *reportLevelOutputDo { return r.withDO(r.DO.Clauses(conds...)) } func (r reportLevelOutputDo) Returning(value interface{}, columns ...string) *reportLevelOutputDo { return r.withDO(r.DO.Returning(value, columns...)) } func (r reportLevelOutputDo) Not(conds ...gen.Condition) *reportLevelOutputDo { return r.withDO(r.DO.Not(conds...)) } func (r reportLevelOutputDo) Or(conds ...gen.Condition) *reportLevelOutputDo { return r.withDO(r.DO.Or(conds...)) } func (r reportLevelOutputDo) Select(conds ...field.Expr) *reportLevelOutputDo { return r.withDO(r.DO.Select(conds...)) } func (r reportLevelOutputDo) Where(conds ...gen.Condition) *reportLevelOutputDo { return r.withDO(r.DO.Where(conds...)) } func (r reportLevelOutputDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportLevelOutputDo { return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (r reportLevelOutputDo) Order(conds ...field.Expr) *reportLevelOutputDo { return r.withDO(r.DO.Order(conds...)) } func (r reportLevelOutputDo) Distinct(cols ...field.Expr) *reportLevelOutputDo { return r.withDO(r.DO.Distinct(cols...)) } func (r reportLevelOutputDo) Omit(cols ...field.Expr) *reportLevelOutputDo { return r.withDO(r.DO.Omit(cols...)) } func (r reportLevelOutputDo) Join(table schema.Tabler, on ...field.Expr) *reportLevelOutputDo { return r.withDO(r.DO.Join(table, on...)) } func (r reportLevelOutputDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportLevelOutputDo { return r.withDO(r.DO.LeftJoin(table, on...)) } func (r reportLevelOutputDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportLevelOutputDo { return r.withDO(r.DO.RightJoin(table, on...)) } func (r reportLevelOutputDo) Group(cols ...field.Expr) *reportLevelOutputDo { return r.withDO(r.DO.Group(cols...)) } func (r reportLevelOutputDo) Having(conds ...gen.Condition) *reportLevelOutputDo { return r.withDO(r.DO.Having(conds...)) } func (r reportLevelOutputDo) Limit(limit int) *reportLevelOutputDo { return r.withDO(r.DO.Limit(limit)) } func (r reportLevelOutputDo) Offset(offset int) *reportLevelOutputDo { return r.withDO(r.DO.Offset(offset)) } func (r reportLevelOutputDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportLevelOutputDo { return r.withDO(r.DO.Scopes(funcs...)) } func (r reportLevelOutputDo) Unscoped() *reportLevelOutputDo { return r.withDO(r.DO.Unscoped()) } func (r reportLevelOutputDo) Create(values ...*model.ReportLevelOutput) error { if len(values) == 0 { return nil } return r.DO.Create(values) } func (r reportLevelOutputDo) CreateInBatches(values []*model.ReportLevelOutput, 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 reportLevelOutputDo) Save(values ...*model.ReportLevelOutput) error { if len(values) == 0 { return nil } return r.DO.Save(values) } func (r reportLevelOutputDo) First() (*model.ReportLevelOutput, error) { if result, err := r.DO.First(); err != nil { return nil, err } else { return result.(*model.ReportLevelOutput), nil } } func (r reportLevelOutputDo) Take() (*model.ReportLevelOutput, error) { if result, err := r.DO.Take(); err != nil { return nil, err } else { return result.(*model.ReportLevelOutput), nil } } func (r reportLevelOutputDo) Last() (*model.ReportLevelOutput, error) { if result, err := r.DO.Last(); err != nil { return nil, err } else { return result.(*model.ReportLevelOutput), nil } } func (r reportLevelOutputDo) Find() ([]*model.ReportLevelOutput, error) { result, err := r.DO.Find() return result.([]*model.ReportLevelOutput), err } func (r reportLevelOutputDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportLevelOutput, err error) { buf := make([]*model.ReportLevelOutput, 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 reportLevelOutputDo) FindInBatches(result *[]*model.ReportLevelOutput, batchSize int, fc func(tx gen.Dao, batch int) error) error { return r.DO.FindInBatches(result, batchSize, fc) } func (r reportLevelOutputDo) Attrs(attrs ...field.AssignExpr) *reportLevelOutputDo { return r.withDO(r.DO.Attrs(attrs...)) } func (r reportLevelOutputDo) Assign(attrs ...field.AssignExpr) *reportLevelOutputDo { return r.withDO(r.DO.Assign(attrs...)) } func (r reportLevelOutputDo) Joins(fields ...field.RelationField) *reportLevelOutputDo { for _, _f := range fields { r = *r.withDO(r.DO.Joins(_f)) } return &r } func (r reportLevelOutputDo) Preload(fields ...field.RelationField) *reportLevelOutputDo { for _, _f := range fields { r = *r.withDO(r.DO.Preload(_f)) } return &r } func (r reportLevelOutputDo) FirstOrInit() (*model.ReportLevelOutput, error) { if result, err := r.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.ReportLevelOutput), nil } } func (r reportLevelOutputDo) FirstOrCreate() (*model.ReportLevelOutput, error) { if result, err := r.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.ReportLevelOutput), nil } } func (r reportLevelOutputDo) FindByPage(offset int, limit int) (result []*model.ReportLevelOutput, 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 reportLevelOutputDo) 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 reportLevelOutputDo) Scan(result interface{}) (err error) { return r.DO.Scan(result) } func (r reportLevelOutputDo) Delete(models ...*model.ReportLevelOutput) (result gen.ResultInfo, err error) { return r.DO.Delete(models) } func (r *reportLevelOutputDo) withDO(do gen.Dao) *reportLevelOutputDo { r.DO = *do.(*gen.DO) return r }