Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 48s
357 lines
10 KiB
Go
357 lines
10 KiB
Go
// 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 dao
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm/clause"
|
|
"gorm.io/gorm/schema"
|
|
|
|
"gorm.io/gen"
|
|
"gorm.io/gen/field"
|
|
|
|
"gorm.io/plugin/dbresolver"
|
|
|
|
"bindbox-game/internal/repository/mysql/model"
|
|
)
|
|
|
|
func newGameTicketLogs(db *gorm.DB, opts ...gen.DOOption) gameTicketLogs {
|
|
_gameTicketLogs := gameTicketLogs{}
|
|
|
|
_gameTicketLogs.gameTicketLogsDo.UseDB(db, opts...)
|
|
_gameTicketLogs.gameTicketLogsDo.UseModel(&model.GameTicketLogs{})
|
|
|
|
tableName := _gameTicketLogs.gameTicketLogsDo.TableName()
|
|
_gameTicketLogs.ALL = field.NewAsterisk(tableName)
|
|
_gameTicketLogs.ID = field.NewInt64(tableName, "id")
|
|
_gameTicketLogs.CreatedAt = field.NewTime(tableName, "created_at")
|
|
_gameTicketLogs.UserID = field.NewInt64(tableName, "user_id")
|
|
_gameTicketLogs.GameCode = field.NewString(tableName, "game_code")
|
|
_gameTicketLogs.ChangeType = field.NewInt32(tableName, "change_type")
|
|
_gameTicketLogs.Amount = field.NewInt32(tableName, "amount")
|
|
_gameTicketLogs.Balance = field.NewInt32(tableName, "balance")
|
|
_gameTicketLogs.Source = field.NewString(tableName, "source")
|
|
_gameTicketLogs.SourceID = field.NewInt64(tableName, "source_id")
|
|
_gameTicketLogs.Remark = field.NewString(tableName, "remark")
|
|
|
|
_gameTicketLogs.fillFieldMap()
|
|
|
|
return _gameTicketLogs
|
|
}
|
|
|
|
// gameTicketLogs 游戏资格变动日志
|
|
type gameTicketLogs struct {
|
|
gameTicketLogsDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Int64
|
|
CreatedAt field.Time
|
|
UserID field.Int64 // 用户ID
|
|
GameCode field.String // 游戏代码
|
|
ChangeType field.Int32 // 1=获得 2=使用
|
|
Amount field.Int32 // 变动数量
|
|
Balance field.Int32 // 变动后余额
|
|
Source field.String // 来源: order/task/admin
|
|
SourceID field.Int64 // 来源ID
|
|
Remark field.String // 备注
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (g gameTicketLogs) Table(newTableName string) *gameTicketLogs {
|
|
g.gameTicketLogsDo.UseTable(newTableName)
|
|
return g.updateTableName(newTableName)
|
|
}
|
|
|
|
func (g gameTicketLogs) As(alias string) *gameTicketLogs {
|
|
g.gameTicketLogsDo.DO = *(g.gameTicketLogsDo.As(alias).(*gen.DO))
|
|
return g.updateTableName(alias)
|
|
}
|
|
|
|
func (g *gameTicketLogs) updateTableName(table string) *gameTicketLogs {
|
|
g.ALL = field.NewAsterisk(table)
|
|
g.ID = field.NewInt64(table, "id")
|
|
g.CreatedAt = field.NewTime(table, "created_at")
|
|
g.UserID = field.NewInt64(table, "user_id")
|
|
g.GameCode = field.NewString(table, "game_code")
|
|
g.ChangeType = field.NewInt32(table, "change_type")
|
|
g.Amount = field.NewInt32(table, "amount")
|
|
g.Balance = field.NewInt32(table, "balance")
|
|
g.Source = field.NewString(table, "source")
|
|
g.SourceID = field.NewInt64(table, "source_id")
|
|
g.Remark = field.NewString(table, "remark")
|
|
|
|
g.fillFieldMap()
|
|
|
|
return g
|
|
}
|
|
|
|
func (g *gameTicketLogs) 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 *gameTicketLogs) fillFieldMap() {
|
|
g.fieldMap = make(map[string]field.Expr, 10)
|
|
g.fieldMap["id"] = g.ID
|
|
g.fieldMap["created_at"] = g.CreatedAt
|
|
g.fieldMap["user_id"] = g.UserID
|
|
g.fieldMap["game_code"] = g.GameCode
|
|
g.fieldMap["change_type"] = g.ChangeType
|
|
g.fieldMap["amount"] = g.Amount
|
|
g.fieldMap["balance"] = g.Balance
|
|
g.fieldMap["source"] = g.Source
|
|
g.fieldMap["source_id"] = g.SourceID
|
|
g.fieldMap["remark"] = g.Remark
|
|
}
|
|
|
|
func (g gameTicketLogs) clone(db *gorm.DB) gameTicketLogs {
|
|
g.gameTicketLogsDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return g
|
|
}
|
|
|
|
func (g gameTicketLogs) replaceDB(db *gorm.DB) gameTicketLogs {
|
|
g.gameTicketLogsDo.ReplaceDB(db)
|
|
return g
|
|
}
|
|
|
|
type gameTicketLogsDo struct{ gen.DO }
|
|
|
|
func (g gameTicketLogsDo) Debug() *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Debug())
|
|
}
|
|
|
|
func (g gameTicketLogsDo) WithContext(ctx context.Context) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) ReadDB() *gameTicketLogsDo {
|
|
return g.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (g gameTicketLogsDo) WriteDB() *gameTicketLogsDo {
|
|
return g.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Session(config *gorm.Session) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Session(config))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Clauses(conds ...clause.Expression) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Returning(value interface{}, columns ...string) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Not(conds ...gen.Condition) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Not(conds...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Or(conds ...gen.Condition) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Or(conds...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Select(conds ...field.Expr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Select(conds...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Where(conds ...gen.Condition) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Where(conds...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Order(conds ...field.Expr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Order(conds...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Distinct(cols ...field.Expr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Omit(cols ...field.Expr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Omit(cols...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Join(table schema.Tabler, on ...field.Expr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Join(table, on...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) LeftJoin(table schema.Tabler, on ...field.Expr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) RightJoin(table schema.Tabler, on ...field.Expr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Group(cols ...field.Expr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Group(cols...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Having(conds ...gen.Condition) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Having(conds...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Limit(limit int) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Limit(limit))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Offset(offset int) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Offset(offset))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Unscoped() *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Unscoped())
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Create(values ...*model.GameTicketLogs) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return g.DO.Create(values)
|
|
}
|
|
|
|
func (g gameTicketLogsDo) CreateInBatches(values []*model.GameTicketLogs, 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 gameTicketLogsDo) Save(values ...*model.GameTicketLogs) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return g.DO.Save(values)
|
|
}
|
|
|
|
func (g gameTicketLogsDo) First() (*model.GameTicketLogs, error) {
|
|
if result, err := g.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.GameTicketLogs), nil
|
|
}
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Take() (*model.GameTicketLogs, error) {
|
|
if result, err := g.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.GameTicketLogs), nil
|
|
}
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Last() (*model.GameTicketLogs, error) {
|
|
if result, err := g.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.GameTicketLogs), nil
|
|
}
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Find() ([]*model.GameTicketLogs, error) {
|
|
result, err := g.DO.Find()
|
|
return result.([]*model.GameTicketLogs), err
|
|
}
|
|
|
|
func (g gameTicketLogsDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.GameTicketLogs, err error) {
|
|
buf := make([]*model.GameTicketLogs, 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 gameTicketLogsDo) FindInBatches(result *[]*model.GameTicketLogs, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return g.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Attrs(attrs ...field.AssignExpr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Assign(attrs ...field.AssignExpr) *gameTicketLogsDo {
|
|
return g.withDO(g.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Joins(fields ...field.RelationField) *gameTicketLogsDo {
|
|
for _, _f := range fields {
|
|
g = *g.withDO(g.DO.Joins(_f))
|
|
}
|
|
return &g
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Preload(fields ...field.RelationField) *gameTicketLogsDo {
|
|
for _, _f := range fields {
|
|
g = *g.withDO(g.DO.Preload(_f))
|
|
}
|
|
return &g
|
|
}
|
|
|
|
func (g gameTicketLogsDo) FirstOrInit() (*model.GameTicketLogs, error) {
|
|
if result, err := g.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.GameTicketLogs), nil
|
|
}
|
|
}
|
|
|
|
func (g gameTicketLogsDo) FirstOrCreate() (*model.GameTicketLogs, error) {
|
|
if result, err := g.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.GameTicketLogs), nil
|
|
}
|
|
}
|
|
|
|
func (g gameTicketLogsDo) FindByPage(offset int, limit int) (result []*model.GameTicketLogs, 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 gameTicketLogsDo) 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 gameTicketLogsDo) Scan(result interface{}) (err error) {
|
|
return g.DO.Scan(result)
|
|
}
|
|
|
|
func (g gameTicketLogsDo) Delete(models ...*model.GameTicketLogs) (result gen.ResultInfo, err error) {
|
|
return g.DO.Delete(models)
|
|
}
|
|
|
|
func (g *gameTicketLogsDo) withDO(do gen.Dao) *gameTicketLogsDo {
|
|
g.DO = *do.(*gen.DO)
|
|
return g
|
|
}
|