|
|
// 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"
|
|
|
|
|
|
"joybuywork/internal/repository/model"
|
|
|
)
|
|
|
|
|
|
func newFissionDiceMap(db *gorm.DB, opts ...gen.DOOption) fissionDiceMap {
|
|
|
_fissionDiceMap := fissionDiceMap{}
|
|
|
|
|
|
_fissionDiceMap.fissionDiceMapDo.UseDB(db, opts...)
|
|
|
_fissionDiceMap.fissionDiceMapDo.UseModel(&model.FissionDiceMap{})
|
|
|
|
|
|
tableName := _fissionDiceMap.fissionDiceMapDo.TableName()
|
|
|
_fissionDiceMap.ALL = field.NewAsterisk(tableName)
|
|
|
_fissionDiceMap.ID = field.NewInt64(tableName, "id")
|
|
|
_fissionDiceMap.CreatedAt = field.NewInt64(tableName, "created_at")
|
|
|
_fissionDiceMap.UpdatedAt = field.NewInt64(tableName, "updated_at")
|
|
|
_fissionDiceMap.HashID = field.NewString(tableName, "hash_id")
|
|
|
_fissionDiceMap.CampaignID = field.NewInt64(tableName, "campaign_id")
|
|
|
_fissionDiceMap.MarkType = field.NewInt8(tableName, "mark_type")
|
|
|
_fissionDiceMap.RewardID = field.NewInt64(tableName, "reward_id")
|
|
|
_fissionDiceMap.DmgID = field.NewInt64(tableName, "dmg_id")
|
|
|
|
|
|
_fissionDiceMap.fillFieldMap()
|
|
|
|
|
|
return _fissionDiceMap
|
|
|
}
|
|
|
|
|
|
type fissionDiceMap struct {
|
|
|
fissionDiceMapDo fissionDiceMapDo
|
|
|
|
|
|
ALL field.Asterisk
|
|
|
ID field.Int64
|
|
|
CreatedAt field.Int64
|
|
|
UpdatedAt field.Int64
|
|
|
HashID field.String // 对外id
|
|
|
CampaignID field.Int64 // 活动ID(fission_campaign表)
|
|
|
MarkType field.Int8 // 格子标识类型(0-什么都没有,1-普通奖品,2-超级奖品,3-再次来一次,4-摇几得几)
|
|
|
RewardID field.Int64 // 奖品id
|
|
|
DmgID field.Int64 // 地图组id(fission_dice_map_group表)
|
|
|
|
|
|
fieldMap map[string]field.Expr
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMap) Table(newTableName string) *fissionDiceMap {
|
|
|
f.fissionDiceMapDo.UseTable(newTableName)
|
|
|
return f.updateTableName(newTableName)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMap) As(alias string) *fissionDiceMap {
|
|
|
f.fissionDiceMapDo.DO = *(f.fissionDiceMapDo.As(alias).(*gen.DO))
|
|
|
return f.updateTableName(alias)
|
|
|
}
|
|
|
|
|
|
func (f *fissionDiceMap) updateTableName(table string) *fissionDiceMap {
|
|
|
f.ALL = field.NewAsterisk(table)
|
|
|
f.ID = field.NewInt64(table, "id")
|
|
|
f.CreatedAt = field.NewInt64(table, "created_at")
|
|
|
f.UpdatedAt = field.NewInt64(table, "updated_at")
|
|
|
f.HashID = field.NewString(table, "hash_id")
|
|
|
f.CampaignID = field.NewInt64(table, "campaign_id")
|
|
|
f.MarkType = field.NewInt8(table, "mark_type")
|
|
|
f.RewardID = field.NewInt64(table, "reward_id")
|
|
|
f.DmgID = field.NewInt64(table, "dmg_id")
|
|
|
|
|
|
f.fillFieldMap()
|
|
|
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
func (f *fissionDiceMap) WithContext(ctx context.Context) *fissionDiceMapDo {
|
|
|
return f.fissionDiceMapDo.WithContext(ctx)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMap) TableName() string { return f.fissionDiceMapDo.TableName() }
|
|
|
|
|
|
func (f fissionDiceMap) Alias() string { return f.fissionDiceMapDo.Alias() }
|
|
|
|
|
|
func (f *fissionDiceMap) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|
|
_f, ok := f.fieldMap[fieldName]
|
|
|
if !ok || _f == nil {
|
|
|
return nil, false
|
|
|
}
|
|
|
_oe, ok := _f.(field.OrderExpr)
|
|
|
return _oe, ok
|
|
|
}
|
|
|
|
|
|
func (f *fissionDiceMap) fillFieldMap() {
|
|
|
f.fieldMap = make(map[string]field.Expr, 8)
|
|
|
f.fieldMap["id"] = f.ID
|
|
|
f.fieldMap["created_at"] = f.CreatedAt
|
|
|
f.fieldMap["updated_at"] = f.UpdatedAt
|
|
|
f.fieldMap["hash_id"] = f.HashID
|
|
|
f.fieldMap["campaign_id"] = f.CampaignID
|
|
|
f.fieldMap["mark_type"] = f.MarkType
|
|
|
f.fieldMap["reward_id"] = f.RewardID
|
|
|
f.fieldMap["dmg_id"] = f.DmgID
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMap) clone(db *gorm.DB) fissionDiceMap {
|
|
|
f.fissionDiceMapDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMap) replaceDB(db *gorm.DB) fissionDiceMap {
|
|
|
f.fissionDiceMapDo.ReplaceDB(db)
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
type fissionDiceMapDo struct{ gen.DO }
|
|
|
|
|
|
func (f fissionDiceMapDo) Debug() *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Debug())
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) WithContext(ctx context.Context) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.WithContext(ctx))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) ReadDB() *fissionDiceMapDo {
|
|
|
return f.Clauses(dbresolver.Read)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) WriteDB() *fissionDiceMapDo {
|
|
|
return f.Clauses(dbresolver.Write)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Session(config *gorm.Session) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Session(config))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Clauses(conds ...clause.Expression) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Clauses(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Returning(value interface{}, columns ...string) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Returning(value, columns...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Not(conds ...gen.Condition) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Not(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Or(conds ...gen.Condition) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Or(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Select(conds ...field.Expr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Select(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Where(conds ...gen.Condition) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Where(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *fissionDiceMapDo {
|
|
|
return f.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Order(conds ...field.Expr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Order(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Distinct(cols ...field.Expr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Distinct(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Omit(cols ...field.Expr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Omit(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Join(table schema.Tabler, on ...field.Expr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Join(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) LeftJoin(table schema.Tabler, on ...field.Expr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.LeftJoin(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) RightJoin(table schema.Tabler, on ...field.Expr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.RightJoin(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Group(cols ...field.Expr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Group(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Having(conds ...gen.Condition) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Having(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Limit(limit int) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Limit(limit))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Offset(offset int) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Offset(offset))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Scopes(funcs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Unscoped() *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Unscoped())
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Create(values ...*model.FissionDiceMap) error {
|
|
|
if len(values) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
return f.DO.Create(values)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) CreateInBatches(values []*model.FissionDiceMap, batchSize int) error {
|
|
|
return f.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 (f fissionDiceMapDo) Save(values ...*model.FissionDiceMap) error {
|
|
|
if len(values) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
return f.DO.Save(values)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) First() (*model.FissionDiceMap, error) {
|
|
|
if result, err := f.DO.First(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMap), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Take() (*model.FissionDiceMap, error) {
|
|
|
if result, err := f.DO.Take(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMap), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Last() (*model.FissionDiceMap, error) {
|
|
|
if result, err := f.DO.Last(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMap), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Find() ([]*model.FissionDiceMap, error) {
|
|
|
result, err := f.DO.Find()
|
|
|
return result.([]*model.FissionDiceMap), err
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FissionDiceMap, err error) {
|
|
|
buf := make([]*model.FissionDiceMap, 0, batchSize)
|
|
|
err = f.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 (f fissionDiceMapDo) FindInBatches(result *[]*model.FissionDiceMap, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
|
return f.DO.FindInBatches(result, batchSize, fc)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Attrs(attrs ...field.AssignExpr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Attrs(attrs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Assign(attrs ...field.AssignExpr) *fissionDiceMapDo {
|
|
|
return f.withDO(f.DO.Assign(attrs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Joins(fields ...field.RelationField) *fissionDiceMapDo {
|
|
|
for _, _f := range fields {
|
|
|
f = *f.withDO(f.DO.Joins(_f))
|
|
|
}
|
|
|
return &f
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Preload(fields ...field.RelationField) *fissionDiceMapDo {
|
|
|
for _, _f := range fields {
|
|
|
f = *f.withDO(f.DO.Preload(_f))
|
|
|
}
|
|
|
return &f
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) FirstOrInit() (*model.FissionDiceMap, error) {
|
|
|
if result, err := f.DO.FirstOrInit(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMap), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) FirstOrCreate() (*model.FissionDiceMap, error) {
|
|
|
if result, err := f.DO.FirstOrCreate(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMap), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) FindByPage(offset int, limit int) (result []*model.FissionDiceMap, count int64, err error) {
|
|
|
result, err = f.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 = f.Offset(-1).Limit(-1).Count()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
|
|
count, err = f.Count()
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
err = f.Offset(offset).Limit(limit).Scan(result)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Scan(result interface{}) (err error) {
|
|
|
return f.DO.Scan(result)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapDo) Delete(models ...*model.FissionDiceMap) (result gen.ResultInfo, err error) {
|
|
|
return f.DO.Delete(models)
|
|
|
}
|
|
|
|
|
|
func (f *fissionDiceMapDo) withDO(do gen.Dao) *fissionDiceMapDo {
|
|
|
f.DO = *do.(*gen.DO)
|
|
|
return f
|
|
|
}
|