// 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 newCuriomake(db *gorm.DB, opts ...gen.DOOption) curiomake { _curiomake := curiomake{} _curiomake.curiomakeDo.UseDB(db, opts...) _curiomake.curiomakeDo.UseModel(&model.Curiomake{}) tableName := _curiomake.curiomakeDo.TableName() _curiomake.ALL = field.NewAsterisk(tableName) _curiomake.Playerid = field.NewInt64(tableName, "playerid") _curiomake.Silver = field.NewInt64(tableName, "silver") _curiomake.TotalSilver = field.NewInt64(tableName, "totalSilver") _curiomake.Energy = field.NewString(tableName, "energy") _curiomake.CombineBox = field.NewString(tableName, "combineBox") _curiomake.CombineReward = field.NewString(tableName, "combineReward") _curiomake.OutBox = field.NewString(tableName, "outBox") _curiomake.Curios = field.NewString(tableName, "curios") _curiomake.Shows = field.NewString(tableName, "shows") _curiomake.Event = field.NewString(tableName, "event") _curiomake.Exchange = field.NewString(tableName, "exchange") _curiomake.LastDrawBaseTick = field.NewInt64(tableName, "lastDrawBaseTick") _curiomake.StartTick = field.NewInt64(tableName, "startTick") _curiomake.fillFieldMap() return _curiomake } type curiomake struct { curiomakeDo ALL field.Asterisk Playerid field.Int64 Silver field.Int64 TotalSilver field.Int64 Energy field.String CombineBox field.String CombineReward field.String OutBox field.String Curios field.String Shows field.String Event field.String Exchange field.String LastDrawBaseTick field.Int64 StartTick field.Int64 fieldMap map[string]field.Expr } func (c curiomake) Table(newTableName string) *curiomake { c.curiomakeDo.UseTable(newTableName) return c.updateTableName(newTableName) } func (c curiomake) As(alias string) *curiomake { c.curiomakeDo.DO = *(c.curiomakeDo.As(alias).(*gen.DO)) return c.updateTableName(alias) } func (c *curiomake) updateTableName(table string) *curiomake { c.ALL = field.NewAsterisk(table) c.Playerid = field.NewInt64(table, "playerid") c.Silver = field.NewInt64(table, "silver") c.TotalSilver = field.NewInt64(table, "totalSilver") c.Energy = field.NewString(table, "energy") c.CombineBox = field.NewString(table, "combineBox") c.CombineReward = field.NewString(table, "combineReward") c.OutBox = field.NewString(table, "outBox") c.Curios = field.NewString(table, "curios") c.Shows = field.NewString(table, "shows") c.Event = field.NewString(table, "event") c.Exchange = field.NewString(table, "exchange") c.LastDrawBaseTick = field.NewInt64(table, "lastDrawBaseTick") c.StartTick = field.NewInt64(table, "startTick") c.fillFieldMap() return c } func (c *curiomake) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := c.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (c *curiomake) fillFieldMap() { c.fieldMap = make(map[string]field.Expr, 13) c.fieldMap["playerid"] = c.Playerid c.fieldMap["silver"] = c.Silver c.fieldMap["totalSilver"] = c.TotalSilver c.fieldMap["energy"] = c.Energy c.fieldMap["combineBox"] = c.CombineBox c.fieldMap["combineReward"] = c.CombineReward c.fieldMap["outBox"] = c.OutBox c.fieldMap["curios"] = c.Curios c.fieldMap["shows"] = c.Shows c.fieldMap["event"] = c.Event c.fieldMap["exchange"] = c.Exchange c.fieldMap["lastDrawBaseTick"] = c.LastDrawBaseTick c.fieldMap["startTick"] = c.StartTick } func (c curiomake) clone(db *gorm.DB) curiomake { c.curiomakeDo.ReplaceConnPool(db.Statement.ConnPool) return c } func (c curiomake) replaceDB(db *gorm.DB) curiomake { c.curiomakeDo.ReplaceDB(db) return c } type curiomakeDo struct{ gen.DO } func (c curiomakeDo) Debug() *curiomakeDo { return c.withDO(c.DO.Debug()) } func (c curiomakeDo) WithContext(ctx context.Context) *curiomakeDo { return c.withDO(c.DO.WithContext(ctx)) } func (c curiomakeDo) ReadDB() *curiomakeDo { return c.Clauses(dbresolver.Read) } func (c curiomakeDo) WriteDB() *curiomakeDo { return c.Clauses(dbresolver.Write) } func (c curiomakeDo) Session(config *gorm.Session) *curiomakeDo { return c.withDO(c.DO.Session(config)) } func (c curiomakeDo) Clauses(conds ...clause.Expression) *curiomakeDo { return c.withDO(c.DO.Clauses(conds...)) } func (c curiomakeDo) Returning(value interface{}, columns ...string) *curiomakeDo { return c.withDO(c.DO.Returning(value, columns...)) } func (c curiomakeDo) Not(conds ...gen.Condition) *curiomakeDo { return c.withDO(c.DO.Not(conds...)) } func (c curiomakeDo) Or(conds ...gen.Condition) *curiomakeDo { return c.withDO(c.DO.Or(conds...)) } func (c curiomakeDo) Select(conds ...field.Expr) *curiomakeDo { return c.withDO(c.DO.Select(conds...)) } func (c curiomakeDo) Where(conds ...gen.Condition) *curiomakeDo { return c.withDO(c.DO.Where(conds...)) } func (c curiomakeDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *curiomakeDo { return c.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (c curiomakeDo) Order(conds ...field.Expr) *curiomakeDo { return c.withDO(c.DO.Order(conds...)) } func (c curiomakeDo) Distinct(cols ...field.Expr) *curiomakeDo { return c.withDO(c.DO.Distinct(cols...)) } func (c curiomakeDo) Omit(cols ...field.Expr) *curiomakeDo { return c.withDO(c.DO.Omit(cols...)) } func (c curiomakeDo) Join(table schema.Tabler, on ...field.Expr) *curiomakeDo { return c.withDO(c.DO.Join(table, on...)) } func (c curiomakeDo) LeftJoin(table schema.Tabler, on ...field.Expr) *curiomakeDo { return c.withDO(c.DO.LeftJoin(table, on...)) } func (c curiomakeDo) RightJoin(table schema.Tabler, on ...field.Expr) *curiomakeDo { return c.withDO(c.DO.RightJoin(table, on...)) } func (c curiomakeDo) Group(cols ...field.Expr) *curiomakeDo { return c.withDO(c.DO.Group(cols...)) } func (c curiomakeDo) Having(conds ...gen.Condition) *curiomakeDo { return c.withDO(c.DO.Having(conds...)) } func (c curiomakeDo) Limit(limit int) *curiomakeDo { return c.withDO(c.DO.Limit(limit)) } func (c curiomakeDo) Offset(offset int) *curiomakeDo { return c.withDO(c.DO.Offset(offset)) } func (c curiomakeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *curiomakeDo { return c.withDO(c.DO.Scopes(funcs...)) } func (c curiomakeDo) Unscoped() *curiomakeDo { return c.withDO(c.DO.Unscoped()) } func (c curiomakeDo) Create(values ...*model.Curiomake) error { if len(values) == 0 { return nil } return c.DO.Create(values) } func (c curiomakeDo) CreateInBatches(values []*model.Curiomake, batchSize int) error { return c.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 (c curiomakeDo) Save(values ...*model.Curiomake) error { if len(values) == 0 { return nil } return c.DO.Save(values) } func (c curiomakeDo) First() (*model.Curiomake, error) { if result, err := c.DO.First(); err != nil { return nil, err } else { return result.(*model.Curiomake), nil } } func (c curiomakeDo) Take() (*model.Curiomake, error) { if result, err := c.DO.Take(); err != nil { return nil, err } else { return result.(*model.Curiomake), nil } } func (c curiomakeDo) Last() (*model.Curiomake, error) { if result, err := c.DO.Last(); err != nil { return nil, err } else { return result.(*model.Curiomake), nil } } func (c curiomakeDo) Find() ([]*model.Curiomake, error) { result, err := c.DO.Find() return result.([]*model.Curiomake), err } func (c curiomakeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Curiomake, err error) { buf := make([]*model.Curiomake, 0, batchSize) err = c.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 (c curiomakeDo) FindInBatches(result *[]*model.Curiomake, batchSize int, fc func(tx gen.Dao, batch int) error) error { return c.DO.FindInBatches(result, batchSize, fc) } func (c curiomakeDo) Attrs(attrs ...field.AssignExpr) *curiomakeDo { return c.withDO(c.DO.Attrs(attrs...)) } func (c curiomakeDo) Assign(attrs ...field.AssignExpr) *curiomakeDo { return c.withDO(c.DO.Assign(attrs...)) } func (c curiomakeDo) Joins(fields ...field.RelationField) *curiomakeDo { for _, _f := range fields { c = *c.withDO(c.DO.Joins(_f)) } return &c } func (c curiomakeDo) Preload(fields ...field.RelationField) *curiomakeDo { for _, _f := range fields { c = *c.withDO(c.DO.Preload(_f)) } return &c } func (c curiomakeDo) FirstOrInit() (*model.Curiomake, error) { if result, err := c.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.Curiomake), nil } } func (c curiomakeDo) FirstOrCreate() (*model.Curiomake, error) { if result, err := c.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.Curiomake), nil } } func (c curiomakeDo) FindByPage(offset int, limit int) (result []*model.Curiomake, count int64, err error) { result, err = c.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 = c.Offset(-1).Limit(-1).Count() return } func (c curiomakeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = c.Count() if err != nil { return } err = c.Offset(offset).Limit(limit).Scan(result) return } func (c curiomakeDo) Scan(result interface{}) (err error) { return c.DO.Scan(result) } func (c curiomakeDo) Delete(models ...*model.Curiomake) (result gen.ResultInfo, err error) { return c.DO.Delete(models) } func (c *curiomakeDo) withDO(do gen.Dao) *curiomakeDo { c.DO = *do.(*gen.DO) return c }