123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- // 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 newReportDayGem(db *gorm.DB, opts ...gen.DOOption) reportDayGem {
- _reportDayGem := reportDayGem{}
- _reportDayGem.reportDayGemDo.UseDB(db, opts...)
- _reportDayGem.reportDayGemDo.UseModel(&model.ReportDayGem{})
- tableName := _reportDayGem.reportDayGemDo.TableName()
- _reportDayGem.ALL = field.NewAsterisk(tableName)
- _reportDayGem.ID = field.NewInt64(tableName, "id")
- _reportDayGem.Date = field.NewString(tableName, "date")
- _reportDayGem.ServerID = field.NewInt32(tableName, "server_id")
- _reportDayGem.PlayerCount = field.NewInt64(tableName, "player_count")
- _reportDayGem.Output = field.NewInt64(tableName, "output")
- _reportDayGem.Part1 = field.NewInt64(tableName, "part1")
- _reportDayGem.Part2 = field.NewInt64(tableName, "part2")
- _reportDayGem.Part3 = field.NewInt64(tableName, "part3")
- _reportDayGem.Part4 = field.NewInt64(tableName, "part4")
- _reportDayGem.Part5 = field.NewInt64(tableName, "part5")
- _reportDayGem.Part6 = field.NewInt64(tableName, "part6")
- _reportDayGem.PartOutput1 = field.NewString(tableName, "part_output1")
- _reportDayGem.PartOutput2 = field.NewString(tableName, "part_output2")
- _reportDayGem.PartOutput3 = field.NewString(tableName, "part_output3")
- _reportDayGem.PartOutput4 = field.NewString(tableName, "part_output4")
- _reportDayGem.PartOutput5 = field.NewString(tableName, "part_output5")
- _reportDayGem.PartOutput6 = field.NewString(tableName, "part_output6")
- _reportDayGem.fillFieldMap()
- return _reportDayGem
- }
- type reportDayGem struct {
- reportDayGemDo
- ALL field.Asterisk
- ID field.Int64 // ID
- Date field.String // 日期
- ServerID field.Int32 // 服务器ID
- PlayerCount field.Int64 // 参与人数
- Output field.Int64 // 总产出数量
- Part1 field.Int64 // 部位1产出数量
- Part2 field.Int64 // 部位2产出数量
- Part3 field.Int64 // 部位3产出数量
- Part4 field.Int64 // 部位4产出数量
- Part5 field.Int64 // 部位5产出数量
- Part6 field.Int64 // 部位6产出数量
- PartOutput1 field.String // 部位1产出
- PartOutput2 field.String // 部位2产出
- PartOutput3 field.String // 部位3产出
- PartOutput4 field.String // 部位4产出
- PartOutput5 field.String // 部位5产出
- PartOutput6 field.String // 部位6产出
- fieldMap map[string]field.Expr
- }
- func (r reportDayGem) Table(newTableName string) *reportDayGem {
- r.reportDayGemDo.UseTable(newTableName)
- return r.updateTableName(newTableName)
- }
- func (r reportDayGem) As(alias string) *reportDayGem {
- r.reportDayGemDo.DO = *(r.reportDayGemDo.As(alias).(*gen.DO))
- return r.updateTableName(alias)
- }
- func (r *reportDayGem) updateTableName(table string) *reportDayGem {
- 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.PlayerCount = field.NewInt64(table, "player_count")
- r.Output = field.NewInt64(table, "output")
- r.Part1 = field.NewInt64(table, "part1")
- r.Part2 = field.NewInt64(table, "part2")
- r.Part3 = field.NewInt64(table, "part3")
- r.Part4 = field.NewInt64(table, "part4")
- r.Part5 = field.NewInt64(table, "part5")
- r.Part6 = field.NewInt64(table, "part6")
- r.PartOutput1 = field.NewString(table, "part_output1")
- r.PartOutput2 = field.NewString(table, "part_output2")
- r.PartOutput3 = field.NewString(table, "part_output3")
- r.PartOutput4 = field.NewString(table, "part_output4")
- r.PartOutput5 = field.NewString(table, "part_output5")
- r.PartOutput6 = field.NewString(table, "part_output6")
- r.fillFieldMap()
- return r
- }
- func (r *reportDayGem) 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 *reportDayGem) fillFieldMap() {
- r.fieldMap = make(map[string]field.Expr, 17)
- r.fieldMap["id"] = r.ID
- r.fieldMap["date"] = r.Date
- r.fieldMap["server_id"] = r.ServerID
- r.fieldMap["player_count"] = r.PlayerCount
- r.fieldMap["output"] = r.Output
- r.fieldMap["part1"] = r.Part1
- r.fieldMap["part2"] = r.Part2
- r.fieldMap["part3"] = r.Part3
- r.fieldMap["part4"] = r.Part4
- r.fieldMap["part5"] = r.Part5
- r.fieldMap["part6"] = r.Part6
- r.fieldMap["part_output1"] = r.PartOutput1
- r.fieldMap["part_output2"] = r.PartOutput2
- r.fieldMap["part_output3"] = r.PartOutput3
- r.fieldMap["part_output4"] = r.PartOutput4
- r.fieldMap["part_output5"] = r.PartOutput5
- r.fieldMap["part_output6"] = r.PartOutput6
- }
- func (r reportDayGem) clone(db *gorm.DB) reportDayGem {
- r.reportDayGemDo.ReplaceConnPool(db.Statement.ConnPool)
- return r
- }
- func (r reportDayGem) replaceDB(db *gorm.DB) reportDayGem {
- r.reportDayGemDo.ReplaceDB(db)
- return r
- }
- type reportDayGemDo struct{ gen.DO }
- func (r reportDayGemDo) Debug() *reportDayGemDo {
- return r.withDO(r.DO.Debug())
- }
- func (r reportDayGemDo) WithContext(ctx context.Context) *reportDayGemDo {
- return r.withDO(r.DO.WithContext(ctx))
- }
- func (r reportDayGemDo) ReadDB() *reportDayGemDo {
- return r.Clauses(dbresolver.Read)
- }
- func (r reportDayGemDo) WriteDB() *reportDayGemDo {
- return r.Clauses(dbresolver.Write)
- }
- func (r reportDayGemDo) Session(config *gorm.Session) *reportDayGemDo {
- return r.withDO(r.DO.Session(config))
- }
- func (r reportDayGemDo) Clauses(conds ...clause.Expression) *reportDayGemDo {
- return r.withDO(r.DO.Clauses(conds...))
- }
- func (r reportDayGemDo) Returning(value interface{}, columns ...string) *reportDayGemDo {
- return r.withDO(r.DO.Returning(value, columns...))
- }
- func (r reportDayGemDo) Not(conds ...gen.Condition) *reportDayGemDo {
- return r.withDO(r.DO.Not(conds...))
- }
- func (r reportDayGemDo) Or(conds ...gen.Condition) *reportDayGemDo {
- return r.withDO(r.DO.Or(conds...))
- }
- func (r reportDayGemDo) Select(conds ...field.Expr) *reportDayGemDo {
- return r.withDO(r.DO.Select(conds...))
- }
- func (r reportDayGemDo) Where(conds ...gen.Condition) *reportDayGemDo {
- return r.withDO(r.DO.Where(conds...))
- }
- func (r reportDayGemDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayGemDo {
- return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
- }
- func (r reportDayGemDo) Order(conds ...field.Expr) *reportDayGemDo {
- return r.withDO(r.DO.Order(conds...))
- }
- func (r reportDayGemDo) Distinct(cols ...field.Expr) *reportDayGemDo {
- return r.withDO(r.DO.Distinct(cols...))
- }
- func (r reportDayGemDo) Omit(cols ...field.Expr) *reportDayGemDo {
- return r.withDO(r.DO.Omit(cols...))
- }
- func (r reportDayGemDo) Join(table schema.Tabler, on ...field.Expr) *reportDayGemDo {
- return r.withDO(r.DO.Join(table, on...))
- }
- func (r reportDayGemDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayGemDo {
- return r.withDO(r.DO.LeftJoin(table, on...))
- }
- func (r reportDayGemDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayGemDo {
- return r.withDO(r.DO.RightJoin(table, on...))
- }
- func (r reportDayGemDo) Group(cols ...field.Expr) *reportDayGemDo {
- return r.withDO(r.DO.Group(cols...))
- }
- func (r reportDayGemDo) Having(conds ...gen.Condition) *reportDayGemDo {
- return r.withDO(r.DO.Having(conds...))
- }
- func (r reportDayGemDo) Limit(limit int) *reportDayGemDo {
- return r.withDO(r.DO.Limit(limit))
- }
- func (r reportDayGemDo) Offset(offset int) *reportDayGemDo {
- return r.withDO(r.DO.Offset(offset))
- }
- func (r reportDayGemDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayGemDo {
- return r.withDO(r.DO.Scopes(funcs...))
- }
- func (r reportDayGemDo) Unscoped() *reportDayGemDo {
- return r.withDO(r.DO.Unscoped())
- }
- func (r reportDayGemDo) Create(values ...*model.ReportDayGem) error {
- if len(values) == 0 {
- return nil
- }
- return r.DO.Create(values)
- }
- func (r reportDayGemDo) CreateInBatches(values []*model.ReportDayGem, 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 reportDayGemDo) Save(values ...*model.ReportDayGem) error {
- if len(values) == 0 {
- return nil
- }
- return r.DO.Save(values)
- }
- func (r reportDayGemDo) First() (*model.ReportDayGem, error) {
- if result, err := r.DO.First(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGem), nil
- }
- }
- func (r reportDayGemDo) Take() (*model.ReportDayGem, error) {
- if result, err := r.DO.Take(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGem), nil
- }
- }
- func (r reportDayGemDo) Last() (*model.ReportDayGem, error) {
- if result, err := r.DO.Last(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGem), nil
- }
- }
- func (r reportDayGemDo) Find() ([]*model.ReportDayGem, error) {
- result, err := r.DO.Find()
- return result.([]*model.ReportDayGem), err
- }
- func (r reportDayGemDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayGem, err error) {
- buf := make([]*model.ReportDayGem, 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 reportDayGemDo) FindInBatches(result *[]*model.ReportDayGem, batchSize int, fc func(tx gen.Dao, batch int) error) error {
- return r.DO.FindInBatches(result, batchSize, fc)
- }
- func (r reportDayGemDo) Attrs(attrs ...field.AssignExpr) *reportDayGemDo {
- return r.withDO(r.DO.Attrs(attrs...))
- }
- func (r reportDayGemDo) Assign(attrs ...field.AssignExpr) *reportDayGemDo {
- return r.withDO(r.DO.Assign(attrs...))
- }
- func (r reportDayGemDo) Joins(fields ...field.RelationField) *reportDayGemDo {
- for _, _f := range fields {
- r = *r.withDO(r.DO.Joins(_f))
- }
- return &r
- }
- func (r reportDayGemDo) Preload(fields ...field.RelationField) *reportDayGemDo {
- for _, _f := range fields {
- r = *r.withDO(r.DO.Preload(_f))
- }
- return &r
- }
- func (r reportDayGemDo) FirstOrInit() (*model.ReportDayGem, error) {
- if result, err := r.DO.FirstOrInit(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGem), nil
- }
- }
- func (r reportDayGemDo) FirstOrCreate() (*model.ReportDayGem, error) {
- if result, err := r.DO.FirstOrCreate(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGem), nil
- }
- }
- func (r reportDayGemDo) FindByPage(offset int, limit int) (result []*model.ReportDayGem, 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 reportDayGemDo) 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 reportDayGemDo) Scan(result interface{}) (err error) {
- return r.DO.Scan(result)
- }
- func (r reportDayGemDo) Delete(models ...*model.ReportDayGem) (result gen.ResultInfo, err error) {
- return r.DO.Delete(models)
- }
- func (r *reportDayGemDo) withDO(do gen.Dao) *reportDayGemDo {
- r.DO = *do.(*gen.DO)
- return r
- }
|