|
|
// 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 newFissionUnoCollect(db *gorm.DB, opts ...gen.DOOption) fissionUnoCollect {
|
|
|
_fissionUnoCollect := fissionUnoCollect{}
|
|
|
|
|
|
_fissionUnoCollect.fissionUnoCollectDo.UseDB(db, opts...)
|
|
|
_fissionUnoCollect.fissionUnoCollectDo.UseModel(&model.FissionUnoCollect{})
|
|
|
|
|
|
tableName := _fissionUnoCollect.fissionUnoCollectDo.TableName()
|
|
|
_fissionUnoCollect.ALL = field.NewAsterisk(tableName)
|
|
|
_fissionUnoCollect.ID = field.NewInt64(tableName, "id")
|
|
|
_fissionUnoCollect.CreatedAt = field.NewInt64(tableName, "created_at")
|
|
|
_fissionUnoCollect.UpdatedAt = field.NewInt64(tableName, "updated_at")
|
|
|
_fissionUnoCollect.UserID = field.NewInt64(tableName, "user_id")
|
|
|
_fissionUnoCollect.CampaignID = field.NewInt64(tableName, "campaign_id")
|
|
|
_fissionUnoCollect.UnoID = field.NewInt64(tableName, "uno_id")
|
|
|
_fissionUnoCollect.Mark = field.NewString(tableName, "mark")
|
|
|
_fissionUnoCollect.SignNum = field.NewInt32(tableName, "sign_num")
|
|
|
_fissionUnoCollect.IntactNum = field.NewInt32(tableName, "intact_num")
|
|
|
_fissionUnoCollect.PreIntactNum = field.NewInt32(tableName, "pre_intact_num")
|
|
|
_fissionUnoCollect.CardInfo = field.NewString(tableName, "card_info")
|
|
|
|
|
|
_fissionUnoCollect.fillFieldMap()
|
|
|
|
|
|
return _fissionUnoCollect
|
|
|
}
|
|
|
|
|
|
type fissionUnoCollect struct {
|
|
|
fissionUnoCollectDo fissionUnoCollectDo
|
|
|
|
|
|
ALL field.Asterisk
|
|
|
ID field.Int64
|
|
|
CreatedAt field.Int64
|
|
|
UpdatedAt field.Int64
|
|
|
UserID field.Int64 // 活动用户ID(fission_user表主键)
|
|
|
CampaignID field.Int64 // 活动ID(fission_campaign表)
|
|
|
UnoID field.Int64 // 玩家id(fission_uno表)
|
|
|
Mark field.String // 收集颜色标识
|
|
|
SignNum field.Int32 // 已经签到天数
|
|
|
IntactNum field.Int32 // 完整奖品数
|
|
|
PreIntactNum field.Int32 // 待合成奖品数
|
|
|
CardInfo field.String // 卡片数据
|
|
|
|
|
|
fieldMap map[string]field.Expr
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollect) Table(newTableName string) *fissionUnoCollect {
|
|
|
f.fissionUnoCollectDo.UseTable(newTableName)
|
|
|
return f.updateTableName(newTableName)
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollect) As(alias string) *fissionUnoCollect {
|
|
|
f.fissionUnoCollectDo.DO = *(f.fissionUnoCollectDo.As(alias).(*gen.DO))
|
|
|
return f.updateTableName(alias)
|
|
|
}
|
|
|
|
|
|
func (f *fissionUnoCollect) updateTableName(table string) *fissionUnoCollect {
|
|
|
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.UserID = field.NewInt64(table, "user_id")
|
|
|
f.CampaignID = field.NewInt64(table, "campaign_id")
|
|
|
f.UnoID = field.NewInt64(table, "uno_id")
|
|
|
f.Mark = field.NewString(table, "mark")
|
|
|
f.SignNum = field.NewInt32(table, "sign_num")
|
|
|
f.IntactNum = field.NewInt32(table, "intact_num")
|
|
|
f.PreIntactNum = field.NewInt32(table, "pre_intact_num")
|
|
|
f.CardInfo = field.NewString(table, "card_info")
|
|
|
|
|
|
f.fillFieldMap()
|
|
|
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
func (f *fissionUnoCollect) WithContext(ctx context.Context) *fissionUnoCollectDo {
|
|
|
return f.fissionUnoCollectDo.WithContext(ctx)
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollect) TableName() string { return f.fissionUnoCollectDo.TableName() }
|
|
|
|
|
|
func (f fissionUnoCollect) Alias() string { return f.fissionUnoCollectDo.Alias() }
|
|
|
|
|
|
func (f *fissionUnoCollect) 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 *fissionUnoCollect) fillFieldMap() {
|
|
|
f.fieldMap = make(map[string]field.Expr, 11)
|
|
|
f.fieldMap["id"] = f.ID
|
|
|
f.fieldMap["created_at"] = f.CreatedAt
|
|
|
f.fieldMap["updated_at"] = f.UpdatedAt
|
|
|
f.fieldMap["user_id"] = f.UserID
|
|
|
f.fieldMap["campaign_id"] = f.CampaignID
|
|
|
f.fieldMap["uno_id"] = f.UnoID
|
|
|
f.fieldMap["mark"] = f.Mark
|
|
|
f.fieldMap["sign_num"] = f.SignNum
|
|
|
f.fieldMap["intact_num"] = f.IntactNum
|
|
|
f.fieldMap["pre_intact_num"] = f.PreIntactNum
|
|
|
f.fieldMap["card_info"] = f.CardInfo
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollect) clone(db *gorm.DB) fissionUnoCollect {
|
|
|
f.fissionUnoCollectDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollect) replaceDB(db *gorm.DB) fissionUnoCollect {
|
|
|
f.fissionUnoCollectDo.ReplaceDB(db)
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
type fissionUnoCollectDo struct{ gen.DO }
|
|
|
|
|
|
func (f fissionUnoCollectDo) Debug() *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Debug())
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) WithContext(ctx context.Context) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.WithContext(ctx))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) ReadDB() *fissionUnoCollectDo {
|
|
|
return f.Clauses(dbresolver.Read)
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) WriteDB() *fissionUnoCollectDo {
|
|
|
return f.Clauses(dbresolver.Write)
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Session(config *gorm.Session) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Session(config))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Clauses(conds ...clause.Expression) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Clauses(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Returning(value interface{}, columns ...string) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Returning(value, columns...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Not(conds ...gen.Condition) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Not(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Or(conds ...gen.Condition) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Or(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Select(conds ...field.Expr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Select(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Where(conds ...gen.Condition) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Where(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *fissionUnoCollectDo {
|
|
|
return f.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Order(conds ...field.Expr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Order(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Distinct(cols ...field.Expr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Distinct(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Omit(cols ...field.Expr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Omit(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Join(table schema.Tabler, on ...field.Expr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Join(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) LeftJoin(table schema.Tabler, on ...field.Expr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.LeftJoin(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) RightJoin(table schema.Tabler, on ...field.Expr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.RightJoin(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Group(cols ...field.Expr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Group(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Having(conds ...gen.Condition) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Having(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Limit(limit int) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Limit(limit))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Offset(offset int) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Offset(offset))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Scopes(funcs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Unscoped() *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Unscoped())
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Create(values ...*model.FissionUnoCollect) error {
|
|
|
if len(values) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
return f.DO.Create(values)
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) CreateInBatches(values []*model.FissionUnoCollect, 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 fissionUnoCollectDo) Save(values ...*model.FissionUnoCollect) error {
|
|
|
if len(values) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
return f.DO.Save(values)
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) First() (*model.FissionUnoCollect, error) {
|
|
|
if result, err := f.DO.First(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionUnoCollect), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Take() (*model.FissionUnoCollect, error) {
|
|
|
if result, err := f.DO.Take(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionUnoCollect), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Last() (*model.FissionUnoCollect, error) {
|
|
|
if result, err := f.DO.Last(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionUnoCollect), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Find() ([]*model.FissionUnoCollect, error) {
|
|
|
result, err := f.DO.Find()
|
|
|
return result.([]*model.FissionUnoCollect), err
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FissionUnoCollect, err error) {
|
|
|
buf := make([]*model.FissionUnoCollect, 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 fissionUnoCollectDo) FindInBatches(result *[]*model.FissionUnoCollect, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
|
return f.DO.FindInBatches(result, batchSize, fc)
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Attrs(attrs ...field.AssignExpr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Attrs(attrs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Assign(attrs ...field.AssignExpr) *fissionUnoCollectDo {
|
|
|
return f.withDO(f.DO.Assign(attrs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Joins(fields ...field.RelationField) *fissionUnoCollectDo {
|
|
|
for _, _f := range fields {
|
|
|
f = *f.withDO(f.DO.Joins(_f))
|
|
|
}
|
|
|
return &f
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Preload(fields ...field.RelationField) *fissionUnoCollectDo {
|
|
|
for _, _f := range fields {
|
|
|
f = *f.withDO(f.DO.Preload(_f))
|
|
|
}
|
|
|
return &f
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) FirstOrInit() (*model.FissionUnoCollect, error) {
|
|
|
if result, err := f.DO.FirstOrInit(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionUnoCollect), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) FirstOrCreate() (*model.FissionUnoCollect, error) {
|
|
|
if result, err := f.DO.FirstOrCreate(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionUnoCollect), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) FindByPage(offset int, limit int) (result []*model.FissionUnoCollect, 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 fissionUnoCollectDo) 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 fissionUnoCollectDo) Scan(result interface{}) (err error) {
|
|
|
return f.DO.Scan(result)
|
|
|
}
|
|
|
|
|
|
func (f fissionUnoCollectDo) Delete(models ...*model.FissionUnoCollect) (result gen.ResultInfo, err error) {
|
|
|
return f.DO.Delete(models)
|
|
|
}
|
|
|
|
|
|
func (f *fissionUnoCollectDo) withDO(do gen.Dao) *fissionUnoCollectDo {
|
|
|
f.DO = *do.(*gen.DO)
|
|
|
return f
|
|
|
}
|