123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- // 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
- }
|