1 Star 0 Fork 0

liuxuezhan/ar-platform

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
t_slotgame.gen.go 12.57 KB
一键复制 编辑 原始数据 按行查看 历史
liuxuezhan 提交于 2025-03-28 15:09 +08:00 . 2025-03-28 15:09:14
// 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"
"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/dao/schema/slot_game"
)
func newSlotGame(db *gorm.DB, opts ...gen.DOOption) slotGame {
_slotGame := slotGame{}
_slotGame.slotGameDo.UseDB(db, opts...)
_slotGame.slotGameDo.UseModel(&slot_game.SlotGame{})
tableName := _slotGame.slotGameDo.TableName()
_slotGame.ALL = field.NewAsterisk(tableName)
_slotGame.ID = field.NewInt64(tableName, "id")
_slotGame.CreatedAt = field.NewInt64(tableName, "created_at")
_slotGame.UpdatedAt = field.NewInt64(tableName, "updated_at")
_slotGame.TimeZone = field.NewInt32(tableName, "time_zone")
_slotGame.DeletedAt = field.NewField(tableName, "deleted_at")
_slotGame.BetSize = field.NewFloat64(tableName, "bet_size")
_slotGame.BetLevel = field.NewInt32(tableName, "bet_level")
_slotGame.BaseBet = field.NewFloat64(tableName, "base_bet")
_slotGame.TotalAmount = field.NewFloat64(tableName, "total_amount")
_slotGame.BetAmount = field.NewFloat64(tableName, "bet_amount")
_slotGame.WinAmount = field.NewFloat64(tableName, "win_amount")
_slotGame.UserID = field.NewInt64(tableName, "user_id")
_slotGame.Json_Bet_XY = field.NewString(tableName, "json_bet_xy")
_slotGame.fillFieldMap()
return _slotGame
}
type slotGame struct {
slotGameDo
ALL field.Asterisk
ID field.Int64
CreatedAt field.Int64
UpdatedAt field.Int64
TimeZone field.Int32
DeletedAt field.Field
BetSize field.Float64
BetLevel field.Int32
BaseBet field.Float64
TotalAmount field.Float64
BetAmount field.Float64
WinAmount field.Float64
UserID field.Int64
Json_Bet_XY field.String
fieldMap map[string]field.Expr
}
func (s slotGame) Table(newTableName string) *slotGame {
s.slotGameDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s slotGame) As(alias string) *slotGame {
s.slotGameDo.DO = *(s.slotGameDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *slotGame) updateTableName(table string) *slotGame {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.CreatedAt = field.NewInt64(table, "created_at")
s.UpdatedAt = field.NewInt64(table, "updated_at")
s.TimeZone = field.NewInt32(table, "time_zone")
s.DeletedAt = field.NewField(table, "deleted_at")
s.BetSize = field.NewFloat64(table, "bet_size")
s.BetLevel = field.NewInt32(table, "bet_level")
s.BaseBet = field.NewFloat64(table, "base_bet")
s.TotalAmount = field.NewFloat64(table, "total_amount")
s.BetAmount = field.NewFloat64(table, "bet_amount")
s.WinAmount = field.NewFloat64(table, "win_amount")
s.UserID = field.NewInt64(table, "user_id")
s.Json_Bet_XY = field.NewString(table, "json_bet_xy")
s.fillFieldMap()
return s
}
func (s *slotGame) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *slotGame) fillFieldMap() {
s.fieldMap = make(map[string]field.Expr, 13)
s.fieldMap["id"] = s.ID
s.fieldMap["created_at"] = s.CreatedAt
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["time_zone"] = s.TimeZone
s.fieldMap["deleted_at"] = s.DeletedAt
s.fieldMap["bet_size"] = s.BetSize
s.fieldMap["bet_level"] = s.BetLevel
s.fieldMap["base_bet"] = s.BaseBet
s.fieldMap["total_amount"] = s.TotalAmount
s.fieldMap["bet_amount"] = s.BetAmount
s.fieldMap["win_amount"] = s.WinAmount
s.fieldMap["user_id"] = s.UserID
s.fieldMap["json_bet_xy"] = s.Json_Bet_XY
}
func (s slotGame) clone(db *gorm.DB) slotGame {
s.slotGameDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s slotGame) replaceDB(db *gorm.DB) slotGame {
s.slotGameDo.ReplaceDB(db)
return s
}
type slotGameDo struct{ gen.DO }
type ISlotGameDo interface {
gen.SubQuery
Debug() ISlotGameDo
WithContext(ctx context.Context) ISlotGameDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() ISlotGameDo
WriteDB() ISlotGameDo
As(alias string) gen.Dao
Session(config *gorm.Session) ISlotGameDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) ISlotGameDo
Not(conds ...gen.Condition) ISlotGameDo
Or(conds ...gen.Condition) ISlotGameDo
Select(conds ...field.Expr) ISlotGameDo
Where(conds ...gen.Condition) ISlotGameDo
Order(conds ...field.Expr) ISlotGameDo
Distinct(cols ...field.Expr) ISlotGameDo
Omit(cols ...field.Expr) ISlotGameDo
Join(table schema.Tabler, on ...field.Expr) ISlotGameDo
LeftJoin(table schema.Tabler, on ...field.Expr) ISlotGameDo
RightJoin(table schema.Tabler, on ...field.Expr) ISlotGameDo
Group(cols ...field.Expr) ISlotGameDo
Having(conds ...gen.Condition) ISlotGameDo
Limit(limit int) ISlotGameDo
Offset(offset int) ISlotGameDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) ISlotGameDo
Unscoped() ISlotGameDo
Create(values ...*slot_game.SlotGame) error
CreateInBatches(values []*slot_game.SlotGame, batchSize int) error
Save(values ...*slot_game.SlotGame) error
First() (*slot_game.SlotGame, error)
Take() (*slot_game.SlotGame, error)
Last() (*slot_game.SlotGame, error)
Find() ([]*slot_game.SlotGame, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*slot_game.SlotGame, err error)
FindInBatches(result *[]*slot_game.SlotGame, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*slot_game.SlotGame) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) ISlotGameDo
Assign(attrs ...field.AssignExpr) ISlotGameDo
Joins(fields ...field.RelationField) ISlotGameDo
Preload(fields ...field.RelationField) ISlotGameDo
FirstOrInit() (*slot_game.SlotGame, error)
FirstOrCreate() (*slot_game.SlotGame, error)
FindByPage(offset int, limit int) (result []*slot_game.SlotGame, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) ISlotGameDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s slotGameDo) Debug() ISlotGameDo {
return s.withDO(s.DO.Debug())
}
func (s slotGameDo) WithContext(ctx context.Context) ISlotGameDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s slotGameDo) ReadDB() ISlotGameDo {
return s.Clauses(dbresolver.Read)
}
func (s slotGameDo) WriteDB() ISlotGameDo {
return s.Clauses(dbresolver.Write)
}
func (s slotGameDo) Session(config *gorm.Session) ISlotGameDo {
return s.withDO(s.DO.Session(config))
}
func (s slotGameDo) Clauses(conds ...clause.Expression) ISlotGameDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s slotGameDo) Returning(value interface{}, columns ...string) ISlotGameDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s slotGameDo) Not(conds ...gen.Condition) ISlotGameDo {
return s.withDO(s.DO.Not(conds...))
}
func (s slotGameDo) Or(conds ...gen.Condition) ISlotGameDo {
return s.withDO(s.DO.Or(conds...))
}
func (s slotGameDo) Select(conds ...field.Expr) ISlotGameDo {
return s.withDO(s.DO.Select(conds...))
}
func (s slotGameDo) Where(conds ...gen.Condition) ISlotGameDo {
return s.withDO(s.DO.Where(conds...))
}
func (s slotGameDo) Order(conds ...field.Expr) ISlotGameDo {
return s.withDO(s.DO.Order(conds...))
}
func (s slotGameDo) Distinct(cols ...field.Expr) ISlotGameDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s slotGameDo) Omit(cols ...field.Expr) ISlotGameDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s slotGameDo) Join(table schema.Tabler, on ...field.Expr) ISlotGameDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s slotGameDo) LeftJoin(table schema.Tabler, on ...field.Expr) ISlotGameDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s slotGameDo) RightJoin(table schema.Tabler, on ...field.Expr) ISlotGameDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s slotGameDo) Group(cols ...field.Expr) ISlotGameDo {
return s.withDO(s.DO.Group(cols...))
}
func (s slotGameDo) Having(conds ...gen.Condition) ISlotGameDo {
return s.withDO(s.DO.Having(conds...))
}
func (s slotGameDo) Limit(limit int) ISlotGameDo {
return s.withDO(s.DO.Limit(limit))
}
func (s slotGameDo) Offset(offset int) ISlotGameDo {
return s.withDO(s.DO.Offset(offset))
}
func (s slotGameDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ISlotGameDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s slotGameDo) Unscoped() ISlotGameDo {
return s.withDO(s.DO.Unscoped())
}
func (s slotGameDo) Create(values ...*slot_game.SlotGame) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s slotGameDo) CreateInBatches(values []*slot_game.SlotGame, batchSize int) error {
return s.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 (s slotGameDo) Save(values ...*slot_game.SlotGame) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s slotGameDo) First() (*slot_game.SlotGame, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*slot_game.SlotGame), nil
}
}
func (s slotGameDo) Take() (*slot_game.SlotGame, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*slot_game.SlotGame), nil
}
}
func (s slotGameDo) Last() (*slot_game.SlotGame, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*slot_game.SlotGame), nil
}
}
func (s slotGameDo) Find() ([]*slot_game.SlotGame, error) {
result, err := s.DO.Find()
return result.([]*slot_game.SlotGame), err
}
func (s slotGameDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*slot_game.SlotGame, err error) {
buf := make([]*slot_game.SlotGame, 0, batchSize)
err = s.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 (s slotGameDo) FindInBatches(result *[]*slot_game.SlotGame, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s slotGameDo) Attrs(attrs ...field.AssignExpr) ISlotGameDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s slotGameDo) Assign(attrs ...field.AssignExpr) ISlotGameDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s slotGameDo) Joins(fields ...field.RelationField) ISlotGameDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s slotGameDo) Preload(fields ...field.RelationField) ISlotGameDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s slotGameDo) FirstOrInit() (*slot_game.SlotGame, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*slot_game.SlotGame), nil
}
}
func (s slotGameDo) FirstOrCreate() (*slot_game.SlotGame, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*slot_game.SlotGame), nil
}
}
func (s slotGameDo) FindByPage(offset int, limit int) (result []*slot_game.SlotGame, count int64, err error) {
result, err = s.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 = s.Offset(-1).Limit(-1).Count()
return
}
func (s slotGameDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s slotGameDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s slotGameDo) Delete(models ...*slot_game.SlotGame) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *slotGameDo) withDO(do gen.Dao) *slotGameDo {
s.DO = *do.(*gen.DO)
return s
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liuxuezhan/ar-platform.git
git@gitee.com:liuxuezhan/ar-platform.git
liuxuezhan
ar-platform
ar-platform
0818f1fff479

搜索帮助