|
|
// 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 newFissionDiceMapGroup(db *gorm.DB, opts ...gen.DOOption) fissionDiceMapGroup {
|
|
|
_fissionDiceMapGroup := fissionDiceMapGroup{}
|
|
|
|
|
|
_fissionDiceMapGroup.fissionDiceMapGroupDo.UseDB(db, opts...)
|
|
|
_fissionDiceMapGroup.fissionDiceMapGroupDo.UseModel(&model.FissionDiceMapGroup{})
|
|
|
|
|
|
tableName := _fissionDiceMapGroup.fissionDiceMapGroupDo.TableName()
|
|
|
_fissionDiceMapGroup.ALL = field.NewAsterisk(tableName)
|
|
|
_fissionDiceMapGroup.ID = field.NewInt64(tableName, "id")
|
|
|
_fissionDiceMapGroup.CreatedAt = field.NewInt64(tableName, "created_at")
|
|
|
_fissionDiceMapGroup.UpdatedAt = field.NewInt64(tableName, "updated_at")
|
|
|
_fissionDiceMapGroup.CampaignID = field.NewInt64(tableName, "campaign_id")
|
|
|
_fissionDiceMapGroup.LevelID = field.NewInt64(tableName, "level_id")
|
|
|
_fissionDiceMapGroup.LangMark = field.NewString(tableName, "lang_mark")
|
|
|
_fissionDiceMapGroup.CountryMark = field.NewString(tableName, "country_mark")
|
|
|
|
|
|
_fissionDiceMapGroup.fillFieldMap()
|
|
|
|
|
|
return _fissionDiceMapGroup
|
|
|
}
|
|
|
|
|
|
type fissionDiceMapGroup struct {
|
|
|
fissionDiceMapGroupDo fissionDiceMapGroupDo
|
|
|
|
|
|
ALL field.Asterisk
|
|
|
ID field.Int64
|
|
|
CreatedAt field.Int64
|
|
|
UpdatedAt field.Int64
|
|
|
CampaignID field.Int64 // 活动id(fission_campaign表)
|
|
|
LevelID field.Int64 // 用户类型id(fission_user_level表)
|
|
|
LangMark field.String // 语言标识
|
|
|
CountryMark field.String // 国家标识
|
|
|
|
|
|
fieldMap map[string]field.Expr
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroup) Table(newTableName string) *fissionDiceMapGroup {
|
|
|
f.fissionDiceMapGroupDo.UseTable(newTableName)
|
|
|
return f.updateTableName(newTableName)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroup) As(alias string) *fissionDiceMapGroup {
|
|
|
f.fissionDiceMapGroupDo.DO = *(f.fissionDiceMapGroupDo.As(alias).(*gen.DO))
|
|
|
return f.updateTableName(alias)
|
|
|
}
|
|
|
|
|
|
func (f *fissionDiceMapGroup) updateTableName(table string) *fissionDiceMapGroup {
|
|
|
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.CampaignID = field.NewInt64(table, "campaign_id")
|
|
|
f.LevelID = field.NewInt64(table, "level_id")
|
|
|
f.LangMark = field.NewString(table, "lang_mark")
|
|
|
f.CountryMark = field.NewString(table, "country_mark")
|
|
|
|
|
|
f.fillFieldMap()
|
|
|
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
func (f *fissionDiceMapGroup) WithContext(ctx context.Context) *fissionDiceMapGroupDo {
|
|
|
return f.fissionDiceMapGroupDo.WithContext(ctx)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroup) TableName() string { return f.fissionDiceMapGroupDo.TableName() }
|
|
|
|
|
|
func (f fissionDiceMapGroup) Alias() string { return f.fissionDiceMapGroupDo.Alias() }
|
|
|
|
|
|
func (f *fissionDiceMapGroup) 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 *fissionDiceMapGroup) fillFieldMap() {
|
|
|
f.fieldMap = make(map[string]field.Expr, 7)
|
|
|
f.fieldMap["id"] = f.ID
|
|
|
f.fieldMap["created_at"] = f.CreatedAt
|
|
|
f.fieldMap["updated_at"] = f.UpdatedAt
|
|
|
f.fieldMap["campaign_id"] = f.CampaignID
|
|
|
f.fieldMap["level_id"] = f.LevelID
|
|
|
f.fieldMap["lang_mark"] = f.LangMark
|
|
|
f.fieldMap["country_mark"] = f.CountryMark
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroup) clone(db *gorm.DB) fissionDiceMapGroup {
|
|
|
f.fissionDiceMapGroupDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroup) replaceDB(db *gorm.DB) fissionDiceMapGroup {
|
|
|
f.fissionDiceMapGroupDo.ReplaceDB(db)
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
type fissionDiceMapGroupDo struct{ gen.DO }
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Debug() *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Debug())
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) WithContext(ctx context.Context) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.WithContext(ctx))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) ReadDB() *fissionDiceMapGroupDo {
|
|
|
return f.Clauses(dbresolver.Read)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) WriteDB() *fissionDiceMapGroupDo {
|
|
|
return f.Clauses(dbresolver.Write)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Session(config *gorm.Session) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Session(config))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Clauses(conds ...clause.Expression) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Clauses(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Returning(value interface{}, columns ...string) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Returning(value, columns...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Not(conds ...gen.Condition) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Not(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Or(conds ...gen.Condition) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Or(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Select(conds ...field.Expr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Select(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Where(conds ...gen.Condition) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Where(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *fissionDiceMapGroupDo {
|
|
|
return f.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Order(conds ...field.Expr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Order(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Distinct(cols ...field.Expr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Distinct(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Omit(cols ...field.Expr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Omit(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Join(table schema.Tabler, on ...field.Expr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Join(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) LeftJoin(table schema.Tabler, on ...field.Expr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.LeftJoin(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) RightJoin(table schema.Tabler, on ...field.Expr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.RightJoin(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Group(cols ...field.Expr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Group(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Having(conds ...gen.Condition) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Having(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Limit(limit int) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Limit(limit))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Offset(offset int) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Offset(offset))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Scopes(funcs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Unscoped() *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Unscoped())
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Create(values ...*model.FissionDiceMapGroup) error {
|
|
|
if len(values) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
return f.DO.Create(values)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) CreateInBatches(values []*model.FissionDiceMapGroup, 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 fissionDiceMapGroupDo) Save(values ...*model.FissionDiceMapGroup) error {
|
|
|
if len(values) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
return f.DO.Save(values)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) First() (*model.FissionDiceMapGroup, error) {
|
|
|
if result, err := f.DO.First(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMapGroup), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Take() (*model.FissionDiceMapGroup, error) {
|
|
|
if result, err := f.DO.Take(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMapGroup), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Last() (*model.FissionDiceMapGroup, error) {
|
|
|
if result, err := f.DO.Last(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMapGroup), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Find() ([]*model.FissionDiceMapGroup, error) {
|
|
|
result, err := f.DO.Find()
|
|
|
return result.([]*model.FissionDiceMapGroup), err
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FissionDiceMapGroup, err error) {
|
|
|
buf := make([]*model.FissionDiceMapGroup, 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 fissionDiceMapGroupDo) FindInBatches(result *[]*model.FissionDiceMapGroup, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
|
return f.DO.FindInBatches(result, batchSize, fc)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Attrs(attrs ...field.AssignExpr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Attrs(attrs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Assign(attrs ...field.AssignExpr) *fissionDiceMapGroupDo {
|
|
|
return f.withDO(f.DO.Assign(attrs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Joins(fields ...field.RelationField) *fissionDiceMapGroupDo {
|
|
|
for _, _f := range fields {
|
|
|
f = *f.withDO(f.DO.Joins(_f))
|
|
|
}
|
|
|
return &f
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Preload(fields ...field.RelationField) *fissionDiceMapGroupDo {
|
|
|
for _, _f := range fields {
|
|
|
f = *f.withDO(f.DO.Preload(_f))
|
|
|
}
|
|
|
return &f
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) FirstOrInit() (*model.FissionDiceMapGroup, error) {
|
|
|
if result, err := f.DO.FirstOrInit(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMapGroup), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) FirstOrCreate() (*model.FissionDiceMapGroup, error) {
|
|
|
if result, err := f.DO.FirstOrCreate(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionDiceMapGroup), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) FindByPage(offset int, limit int) (result []*model.FissionDiceMapGroup, 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 fissionDiceMapGroupDo) 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 fissionDiceMapGroupDo) Scan(result interface{}) (err error) {
|
|
|
return f.DO.Scan(result)
|
|
|
}
|
|
|
|
|
|
func (f fissionDiceMapGroupDo) Delete(models ...*model.FissionDiceMapGroup) (result gen.ResultInfo, err error) {
|
|
|
return f.DO.Delete(models)
|
|
|
}
|
|
|
|
|
|
func (f *fissionDiceMapGroupDo) withDO(do gen.Dao) *fissionDiceMapGroupDo {
|
|
|
f.DO = *do.(*gen.DO)
|
|
|
return f
|
|
|
}
|