bindbox-game/internal/repository/mysql/dao/activity_draw_logs.gen.go

357 lines
10 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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 newActivityDrawLogs(db *gorm.DB, opts ...gen.DOOption) activityDrawLogs {
_activityDrawLogs := activityDrawLogs{}
_activityDrawLogs.activityDrawLogsDo.UseDB(db, opts...)
_activityDrawLogs.activityDrawLogsDo.UseModel(&model.ActivityDrawLogs{})
tableName := _activityDrawLogs.activityDrawLogsDo.TableName()
_activityDrawLogs.ALL = field.NewAsterisk(tableName)
_activityDrawLogs.ID = field.NewInt64(tableName, "id")
_activityDrawLogs.CreatedAt = field.NewTime(tableName, "created_at")
_activityDrawLogs.UserID = field.NewInt64(tableName, "user_id")
_activityDrawLogs.IssueID = field.NewInt64(tableName, "issue_id")
_activityDrawLogs.OrderID = field.NewInt64(tableName, "order_id")
_activityDrawLogs.RewardID = field.NewInt64(tableName, "reward_id")
_activityDrawLogs.IsWinner = field.NewInt32(tableName, "is_winner")
_activityDrawLogs.Level = field.NewInt32(tableName, "level")
_activityDrawLogs.CurrentLevel = field.NewInt32(tableName, "current_level")
_activityDrawLogs.DrawIndex = field.NewInt64(tableName, "draw_index")
_activityDrawLogs.fillFieldMap()
return _activityDrawLogs
}
// activityDrawLogs 抽奖日志
type activityDrawLogs struct {
activityDrawLogsDo
ALL field.Asterisk
ID field.Int64 // 主键ID
CreatedAt field.Time // 创建时间
UserID field.Int64 // 用户IDmall_user.id
IssueID field.Int64 // 期IDactivity_issues.id
OrderID field.Int64 // 抽奖票据订单IDorders.id
RewardID field.Int64 // 命中奖励IDactivity_reward_settings.id
IsWinner field.Int32 // 是否中奖0否 1是
Level field.Int32 // 中奖等级如1=S 2=A 3=B
CurrentLevel field.Int32 // 当前层针对爬塔其它默认为1
DrawIndex field.Int64 // 抽奖序号(0-N)
fieldMap map[string]field.Expr
}
func (a activityDrawLogs) Table(newTableName string) *activityDrawLogs {
a.activityDrawLogsDo.UseTable(newTableName)
return a.updateTableName(newTableName)
}
func (a activityDrawLogs) As(alias string) *activityDrawLogs {
a.activityDrawLogsDo.DO = *(a.activityDrawLogsDo.As(alias).(*gen.DO))
return a.updateTableName(alias)
}
func (a *activityDrawLogs) updateTableName(table string) *activityDrawLogs {
a.ALL = field.NewAsterisk(table)
a.ID = field.NewInt64(table, "id")
a.CreatedAt = field.NewTime(table, "created_at")
a.UserID = field.NewInt64(table, "user_id")
a.IssueID = field.NewInt64(table, "issue_id")
a.OrderID = field.NewInt64(table, "order_id")
a.RewardID = field.NewInt64(table, "reward_id")
a.IsWinner = field.NewInt32(table, "is_winner")
a.Level = field.NewInt32(table, "level")
a.CurrentLevel = field.NewInt32(table, "current_level")
a.DrawIndex = field.NewInt64(table, "draw_index")
a.fillFieldMap()
return a
}
func (a *activityDrawLogs) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := a.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (a *activityDrawLogs) fillFieldMap() {
a.fieldMap = make(map[string]field.Expr, 10)
a.fieldMap["id"] = a.ID
a.fieldMap["created_at"] = a.CreatedAt
a.fieldMap["user_id"] = a.UserID
a.fieldMap["issue_id"] = a.IssueID
a.fieldMap["order_id"] = a.OrderID
a.fieldMap["reward_id"] = a.RewardID
a.fieldMap["is_winner"] = a.IsWinner
a.fieldMap["level"] = a.Level
a.fieldMap["current_level"] = a.CurrentLevel
a.fieldMap["draw_index"] = a.DrawIndex
}
func (a activityDrawLogs) clone(db *gorm.DB) activityDrawLogs {
a.activityDrawLogsDo.ReplaceConnPool(db.Statement.ConnPool)
return a
}
func (a activityDrawLogs) replaceDB(db *gorm.DB) activityDrawLogs {
a.activityDrawLogsDo.ReplaceDB(db)
return a
}
type activityDrawLogsDo struct{ gen.DO }
func (a activityDrawLogsDo) Debug() *activityDrawLogsDo {
return a.withDO(a.DO.Debug())
}
func (a activityDrawLogsDo) WithContext(ctx context.Context) *activityDrawLogsDo {
return a.withDO(a.DO.WithContext(ctx))
}
func (a activityDrawLogsDo) ReadDB() *activityDrawLogsDo {
return a.Clauses(dbresolver.Read)
}
func (a activityDrawLogsDo) WriteDB() *activityDrawLogsDo {
return a.Clauses(dbresolver.Write)
}
func (a activityDrawLogsDo) Session(config *gorm.Session) *activityDrawLogsDo {
return a.withDO(a.DO.Session(config))
}
func (a activityDrawLogsDo) Clauses(conds ...clause.Expression) *activityDrawLogsDo {
return a.withDO(a.DO.Clauses(conds...))
}
func (a activityDrawLogsDo) Returning(value interface{}, columns ...string) *activityDrawLogsDo {
return a.withDO(a.DO.Returning(value, columns...))
}
func (a activityDrawLogsDo) Not(conds ...gen.Condition) *activityDrawLogsDo {
return a.withDO(a.DO.Not(conds...))
}
func (a activityDrawLogsDo) Or(conds ...gen.Condition) *activityDrawLogsDo {
return a.withDO(a.DO.Or(conds...))
}
func (a activityDrawLogsDo) Select(conds ...field.Expr) *activityDrawLogsDo {
return a.withDO(a.DO.Select(conds...))
}
func (a activityDrawLogsDo) Where(conds ...gen.Condition) *activityDrawLogsDo {
return a.withDO(a.DO.Where(conds...))
}
func (a activityDrawLogsDo) Order(conds ...field.Expr) *activityDrawLogsDo {
return a.withDO(a.DO.Order(conds...))
}
func (a activityDrawLogsDo) Distinct(cols ...field.Expr) *activityDrawLogsDo {
return a.withDO(a.DO.Distinct(cols...))
}
func (a activityDrawLogsDo) Omit(cols ...field.Expr) *activityDrawLogsDo {
return a.withDO(a.DO.Omit(cols...))
}
func (a activityDrawLogsDo) Join(table schema.Tabler, on ...field.Expr) *activityDrawLogsDo {
return a.withDO(a.DO.Join(table, on...))
}
func (a activityDrawLogsDo) LeftJoin(table schema.Tabler, on ...field.Expr) *activityDrawLogsDo {
return a.withDO(a.DO.LeftJoin(table, on...))
}
func (a activityDrawLogsDo) RightJoin(table schema.Tabler, on ...field.Expr) *activityDrawLogsDo {
return a.withDO(a.DO.RightJoin(table, on...))
}
func (a activityDrawLogsDo) Group(cols ...field.Expr) *activityDrawLogsDo {
return a.withDO(a.DO.Group(cols...))
}
func (a activityDrawLogsDo) Having(conds ...gen.Condition) *activityDrawLogsDo {
return a.withDO(a.DO.Having(conds...))
}
func (a activityDrawLogsDo) Limit(limit int) *activityDrawLogsDo {
return a.withDO(a.DO.Limit(limit))
}
func (a activityDrawLogsDo) Offset(offset int) *activityDrawLogsDo {
return a.withDO(a.DO.Offset(offset))
}
func (a activityDrawLogsDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *activityDrawLogsDo {
return a.withDO(a.DO.Scopes(funcs...))
}
func (a activityDrawLogsDo) Unscoped() *activityDrawLogsDo {
return a.withDO(a.DO.Unscoped())
}
func (a activityDrawLogsDo) Create(values ...*model.ActivityDrawLogs) error {
if len(values) == 0 {
return nil
}
return a.DO.Create(values)
}
func (a activityDrawLogsDo) CreateInBatches(values []*model.ActivityDrawLogs, batchSize int) error {
return a.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 (a activityDrawLogsDo) Save(values ...*model.ActivityDrawLogs) error {
if len(values) == 0 {
return nil
}
return a.DO.Save(values)
}
func (a activityDrawLogsDo) First() (*model.ActivityDrawLogs, error) {
if result, err := a.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ActivityDrawLogs), nil
}
}
func (a activityDrawLogsDo) Take() (*model.ActivityDrawLogs, error) {
if result, err := a.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ActivityDrawLogs), nil
}
}
func (a activityDrawLogsDo) Last() (*model.ActivityDrawLogs, error) {
if result, err := a.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ActivityDrawLogs), nil
}
}
func (a activityDrawLogsDo) Find() ([]*model.ActivityDrawLogs, error) {
result, err := a.DO.Find()
return result.([]*model.ActivityDrawLogs), err
}
func (a activityDrawLogsDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ActivityDrawLogs, err error) {
buf := make([]*model.ActivityDrawLogs, 0, batchSize)
err = a.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 (a activityDrawLogsDo) FindInBatches(result *[]*model.ActivityDrawLogs, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return a.DO.FindInBatches(result, batchSize, fc)
}
func (a activityDrawLogsDo) Attrs(attrs ...field.AssignExpr) *activityDrawLogsDo {
return a.withDO(a.DO.Attrs(attrs...))
}
func (a activityDrawLogsDo) Assign(attrs ...field.AssignExpr) *activityDrawLogsDo {
return a.withDO(a.DO.Assign(attrs...))
}
func (a activityDrawLogsDo) Joins(fields ...field.RelationField) *activityDrawLogsDo {
for _, _f := range fields {
a = *a.withDO(a.DO.Joins(_f))
}
return &a
}
func (a activityDrawLogsDo) Preload(fields ...field.RelationField) *activityDrawLogsDo {
for _, _f := range fields {
a = *a.withDO(a.DO.Preload(_f))
}
return &a
}
func (a activityDrawLogsDo) FirstOrInit() (*model.ActivityDrawLogs, error) {
if result, err := a.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ActivityDrawLogs), nil
}
}
func (a activityDrawLogsDo) FirstOrCreate() (*model.ActivityDrawLogs, error) {
if result, err := a.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ActivityDrawLogs), nil
}
}
func (a activityDrawLogsDo) FindByPage(offset int, limit int) (result []*model.ActivityDrawLogs, count int64, err error) {
result, err = a.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 = a.Offset(-1).Limit(-1).Count()
return
}
func (a activityDrawLogsDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = a.Count()
if err != nil {
return
}
err = a.Offset(offset).Limit(limit).Scan(result)
return
}
func (a activityDrawLogsDo) Scan(result interface{}) (err error) {
return a.DO.Scan(result)
}
func (a activityDrawLogsDo) Delete(models ...*model.ActivityDrawLogs) (result gen.ResultInfo, err error) {
return a.DO.Delete(models)
}
func (a *activityDrawLogsDo) withDO(do gen.Dao) *activityDrawLogsDo {
a.DO = *do.(*gen.DO)
return a
}