// 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 newGrandmasterMatch(db *gorm.DB, opts ...gen.DOOption) grandmasterMatch { _grandmasterMatch := grandmasterMatch{} _grandmasterMatch.grandmasterMatchDo.UseDB(db, opts...) _grandmasterMatch.grandmasterMatchDo.UseModel(&model.GrandmasterMatch{}) tableName := _grandmasterMatch.grandmasterMatchDo.TableName() _grandmasterMatch.ALL = field.NewAsterisk(tableName) _grandmasterMatch.ID = field.NewInt64(tableName, "id") _grandmasterMatch.Type = field.NewInt32(tableName, "type") _grandmasterMatch.Seconds = field.NewInt64(tableName, "seconds") _grandmasterMatch.Times = field.NewInt64(tableName, "times") _grandmasterMatch.fillFieldMap() return _grandmasterMatch } type grandmasterMatch struct { grandmasterMatchDo ALL field.Asterisk ID field.Int64 Type field.Int32 // 1成功2失败 Seconds field.Int64 // 匹配时长 Times field.Int64 // 出现次数 fieldMap map[string]field.Expr } func (g grandmasterMatch) Table(newTableName string) *grandmasterMatch { g.grandmasterMatchDo.UseTable(newTableName) return g.updateTableName(newTableName) } func (g grandmasterMatch) As(alias string) *grandmasterMatch { g.grandmasterMatchDo.DO = *(g.grandmasterMatchDo.As(alias).(*gen.DO)) return g.updateTableName(alias) } func (g *grandmasterMatch) updateTableName(table string) *grandmasterMatch { g.ALL = field.NewAsterisk(table) g.ID = field.NewInt64(table, "id") g.Type = field.NewInt32(table, "type") g.Seconds = field.NewInt64(table, "seconds") g.Times = field.NewInt64(table, "times") g.fillFieldMap() return g } func (g *grandmasterMatch) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := g.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (g *grandmasterMatch) fillFieldMap() { g.fieldMap = make(map[string]field.Expr, 4) g.fieldMap["id"] = g.ID g.fieldMap["type"] = g.Type g.fieldMap["seconds"] = g.Seconds g.fieldMap["times"] = g.Times } func (g grandmasterMatch) clone(db *gorm.DB) grandmasterMatch { g.grandmasterMatchDo.ReplaceConnPool(db.Statement.ConnPool) return g } func (g grandmasterMatch) replaceDB(db *gorm.DB) grandmasterMatch { g.grandmasterMatchDo.ReplaceDB(db) return g } type grandmasterMatchDo struct{ gen.DO } func (g grandmasterMatchDo) Debug() *grandmasterMatchDo { return g.withDO(g.DO.Debug()) } func (g grandmasterMatchDo) WithContext(ctx context.Context) *grandmasterMatchDo { return g.withDO(g.DO.WithContext(ctx)) } func (g grandmasterMatchDo) ReadDB() *grandmasterMatchDo { return g.Clauses(dbresolver.Read) } func (g grandmasterMatchDo) WriteDB() *grandmasterMatchDo { return g.Clauses(dbresolver.Write) } func (g grandmasterMatchDo) Session(config *gorm.Session) *grandmasterMatchDo { return g.withDO(g.DO.Session(config)) } func (g grandmasterMatchDo) Clauses(conds ...clause.Expression) *grandmasterMatchDo { return g.withDO(g.DO.Clauses(conds...)) } func (g grandmasterMatchDo) Returning(value interface{}, columns ...string) *grandmasterMatchDo { return g.withDO(g.DO.Returning(value, columns...)) } func (g grandmasterMatchDo) Not(conds ...gen.Condition) *grandmasterMatchDo { return g.withDO(g.DO.Not(conds...)) } func (g grandmasterMatchDo) Or(conds ...gen.Condition) *grandmasterMatchDo { return g.withDO(g.DO.Or(conds...)) } func (g grandmasterMatchDo) Select(conds ...field.Expr) *grandmasterMatchDo { return g.withDO(g.DO.Select(conds...)) } func (g grandmasterMatchDo) Where(conds ...gen.Condition) *grandmasterMatchDo { return g.withDO(g.DO.Where(conds...)) } func (g grandmasterMatchDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *grandmasterMatchDo { return g.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (g grandmasterMatchDo) Order(conds ...field.Expr) *grandmasterMatchDo { return g.withDO(g.DO.Order(conds...)) } func (g grandmasterMatchDo) Distinct(cols ...field.Expr) *grandmasterMatchDo { return g.withDO(g.DO.Distinct(cols...)) } func (g grandmasterMatchDo) Omit(cols ...field.Expr) *grandmasterMatchDo { return g.withDO(g.DO.Omit(cols...)) } func (g grandmasterMatchDo) Join(table schema.Tabler, on ...field.Expr) *grandmasterMatchDo { return g.withDO(g.DO.Join(table, on...)) } func (g grandmasterMatchDo) LeftJoin(table schema.Tabler, on ...field.Expr) *grandmasterMatchDo { return g.withDO(g.DO.LeftJoin(table, on...)) } func (g grandmasterMatchDo) RightJoin(table schema.Tabler, on ...field.Expr) *grandmasterMatchDo { return g.withDO(g.DO.RightJoin(table, on...)) } func (g grandmasterMatchDo) Group(cols ...field.Expr) *grandmasterMatchDo { return g.withDO(g.DO.Group(cols...)) } func (g grandmasterMatchDo) Having(conds ...gen.Condition) *grandmasterMatchDo { return g.withDO(g.DO.Having(conds...)) } func (g grandmasterMatchDo) Limit(limit int) *grandmasterMatchDo { return g.withDO(g.DO.Limit(limit)) } func (g grandmasterMatchDo) Offset(offset int) *grandmasterMatchDo { return g.withDO(g.DO.Offset(offset)) } func (g grandmasterMatchDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *grandmasterMatchDo { return g.withDO(g.DO.Scopes(funcs...)) } func (g grandmasterMatchDo) Unscoped() *grandmasterMatchDo { return g.withDO(g.DO.Unscoped()) } func (g grandmasterMatchDo) Create(values ...*model.GrandmasterMatch) error { if len(values) == 0 { return nil } return g.DO.Create(values) } func (g grandmasterMatchDo) CreateInBatches(values []*model.GrandmasterMatch, batchSize int) error { return g.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 (g grandmasterMatchDo) Save(values ...*model.GrandmasterMatch) error { if len(values) == 0 { return nil } return g.DO.Save(values) } func (g grandmasterMatchDo) First() (*model.GrandmasterMatch, error) { if result, err := g.DO.First(); err != nil { return nil, err } else { return result.(*model.GrandmasterMatch), nil } } func (g grandmasterMatchDo) Take() (*model.GrandmasterMatch, error) { if result, err := g.DO.Take(); err != nil { return nil, err } else { return result.(*model.GrandmasterMatch), nil } } func (g grandmasterMatchDo) Last() (*model.GrandmasterMatch, error) { if result, err := g.DO.Last(); err != nil { return nil, err } else { return result.(*model.GrandmasterMatch), nil } } func (g grandmasterMatchDo) Find() ([]*model.GrandmasterMatch, error) { result, err := g.DO.Find() return result.([]*model.GrandmasterMatch), err } func (g grandmasterMatchDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.GrandmasterMatch, err error) { buf := make([]*model.GrandmasterMatch, 0, batchSize) err = g.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 (g grandmasterMatchDo) FindInBatches(result *[]*model.GrandmasterMatch, batchSize int, fc func(tx gen.Dao, batch int) error) error { return g.DO.FindInBatches(result, batchSize, fc) } func (g grandmasterMatchDo) Attrs(attrs ...field.AssignExpr) *grandmasterMatchDo { return g.withDO(g.DO.Attrs(attrs...)) } func (g grandmasterMatchDo) Assign(attrs ...field.AssignExpr) *grandmasterMatchDo { return g.withDO(g.DO.Assign(attrs...)) } func (g grandmasterMatchDo) Joins(fields ...field.RelationField) *grandmasterMatchDo { for _, _f := range fields { g = *g.withDO(g.DO.Joins(_f)) } return &g } func (g grandmasterMatchDo) Preload(fields ...field.RelationField) *grandmasterMatchDo { for _, _f := range fields { g = *g.withDO(g.DO.Preload(_f)) } return &g } func (g grandmasterMatchDo) FirstOrInit() (*model.GrandmasterMatch, error) { if result, err := g.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.GrandmasterMatch), nil } } func (g grandmasterMatchDo) FirstOrCreate() (*model.GrandmasterMatch, error) { if result, err := g.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.GrandmasterMatch), nil } } func (g grandmasterMatchDo) FindByPage(offset int, limit int) (result []*model.GrandmasterMatch, count int64, err error) { result, err = g.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 = g.Offset(-1).Limit(-1).Count() return } func (g grandmasterMatchDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = g.Count() if err != nil { return } err = g.Offset(offset).Limit(limit).Scan(result) return } func (g grandmasterMatchDo) Scan(result interface{}) (err error) { return g.DO.Scan(result) } func (g grandmasterMatchDo) Delete(models ...*model.GrandmasterMatch) (result gen.ResultInfo, err error) { return g.DO.Delete(models) } func (g *grandmasterMatchDo) withDO(do gen.Dao) *grandmasterMatchDo { g.DO = *do.(*gen.DO) return g }