|
|
// 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 newFissionNotify(db *gorm.DB, opts ...gen.DOOption) fissionNotify {
|
|
|
_fissionNotify := fissionNotify{}
|
|
|
|
|
|
_fissionNotify.fissionNotifyDo.UseDB(db, opts...)
|
|
|
_fissionNotify.fissionNotifyDo.UseModel(&model.FissionNotify{})
|
|
|
|
|
|
tableName := _fissionNotify.fissionNotifyDo.TableName()
|
|
|
_fissionNotify.ALL = field.NewAsterisk(tableName)
|
|
|
_fissionNotify.ID = field.NewInt64(tableName, "id")
|
|
|
_fissionNotify.CreatedAt = field.NewInt64(tableName, "created_at")
|
|
|
_fissionNotify.UpdatedAt = field.NewInt64(tableName, "updated_at")
|
|
|
_fissionNotify.HashID = field.NewString(tableName, "hash_id")
|
|
|
_fissionNotify.CampaignID = field.NewInt64(tableName, "campaign_id")
|
|
|
_fissionNotify.RecordID = field.NewInt64(tableName, "record_id")
|
|
|
_fissionNotify.RewardID = field.NewInt64(tableName, "reward_id")
|
|
|
_fissionNotify.NotifyType = field.NewInt8(tableName, "notify_type")
|
|
|
_fissionNotify.NotifyURL = field.NewString(tableName, "notify_url")
|
|
|
_fissionNotify.Token = field.NewString(tableName, "token")
|
|
|
_fissionNotify.Body = field.NewString(tableName, "body")
|
|
|
_fissionNotify.PushNum = field.NewInt32(tableName, "push_num")
|
|
|
_fissionNotify.IsOk = field.NewInt8(tableName, "is_ok")
|
|
|
_fissionNotify.PushLadder = field.NewInt8(tableName, "push_ladder")
|
|
|
_fissionNotify.Headers = field.NewString(tableName, "headers")
|
|
|
|
|
|
_fissionNotify.fillFieldMap()
|
|
|
|
|
|
return _fissionNotify
|
|
|
}
|
|
|
|
|
|
type fissionNotify struct {
|
|
|
fissionNotifyDo fissionNotifyDo
|
|
|
|
|
|
ALL field.Asterisk
|
|
|
ID field.Int64
|
|
|
CreatedAt field.Int64
|
|
|
UpdatedAt field.Int64
|
|
|
HashID field.String // 对外hash_id
|
|
|
CampaignID field.Int64 // 活动id(fission_campaign表)
|
|
|
RecordID field.Int64 // 玩法奖品记录id(fission_reward_record表)
|
|
|
RewardID field.Int64 // 奖品id(活动下对应的用户奖品表id)
|
|
|
NotifyType field.Int8 // 回调类型(1-服务端回调,2-客户端监听)
|
|
|
NotifyURL field.String // 回调地址
|
|
|
Token field.String // 回调的token
|
|
|
Body field.String // 推送数据
|
|
|
PushNum field.Int32 // 推送次数
|
|
|
IsOk field.Int8 // 是否推送成功(0-否,1-是)
|
|
|
PushLadder field.Int8 // 是否开启转发推送
|
|
|
Headers field.String // 请求头数据
|
|
|
|
|
|
fieldMap map[string]field.Expr
|
|
|
}
|
|
|
|
|
|
func (f fissionNotify) Table(newTableName string) *fissionNotify {
|
|
|
f.fissionNotifyDo.UseTable(newTableName)
|
|
|
return f.updateTableName(newTableName)
|
|
|
}
|
|
|
|
|
|
func (f fissionNotify) As(alias string) *fissionNotify {
|
|
|
f.fissionNotifyDo.DO = *(f.fissionNotifyDo.As(alias).(*gen.DO))
|
|
|
return f.updateTableName(alias)
|
|
|
}
|
|
|
|
|
|
func (f *fissionNotify) updateTableName(table string) *fissionNotify {
|
|
|
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.RecordID = field.NewInt64(table, "record_id")
|
|
|
f.RewardID = field.NewInt64(table, "reward_id")
|
|
|
f.NotifyType = field.NewInt8(table, "notify_type")
|
|
|
f.NotifyURL = field.NewString(table, "notify_url")
|
|
|
f.Token = field.NewString(table, "token")
|
|
|
f.Body = field.NewString(table, "body")
|
|
|
f.PushNum = field.NewInt32(table, "push_num")
|
|
|
f.IsOk = field.NewInt8(table, "is_ok")
|
|
|
f.PushLadder = field.NewInt8(table, "push_ladder")
|
|
|
f.Headers = field.NewString(table, "headers")
|
|
|
|
|
|
f.fillFieldMap()
|
|
|
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
func (f *fissionNotify) WithContext(ctx context.Context) *fissionNotifyDo {
|
|
|
return f.fissionNotifyDo.WithContext(ctx)
|
|
|
}
|
|
|
|
|
|
func (f fissionNotify) TableName() string { return f.fissionNotifyDo.TableName() }
|
|
|
|
|
|
func (f fissionNotify) Alias() string { return f.fissionNotifyDo.Alias() }
|
|
|
|
|
|
func (f *fissionNotify) 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 *fissionNotify) fillFieldMap() {
|
|
|
f.fieldMap = make(map[string]field.Expr, 15)
|
|
|
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["record_id"] = f.RecordID
|
|
|
f.fieldMap["reward_id"] = f.RewardID
|
|
|
f.fieldMap["notify_type"] = f.NotifyType
|
|
|
f.fieldMap["notify_url"] = f.NotifyURL
|
|
|
f.fieldMap["token"] = f.Token
|
|
|
f.fieldMap["body"] = f.Body
|
|
|
f.fieldMap["push_num"] = f.PushNum
|
|
|
f.fieldMap["is_ok"] = f.IsOk
|
|
|
f.fieldMap["push_ladder"] = f.PushLadder
|
|
|
f.fieldMap["headers"] = f.Headers
|
|
|
}
|
|
|
|
|
|
func (f fissionNotify) clone(db *gorm.DB) fissionNotify {
|
|
|
f.fissionNotifyDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
func (f fissionNotify) replaceDB(db *gorm.DB) fissionNotify {
|
|
|
f.fissionNotifyDo.ReplaceDB(db)
|
|
|
return f
|
|
|
}
|
|
|
|
|
|
type fissionNotifyDo struct{ gen.DO }
|
|
|
|
|
|
func (f fissionNotifyDo) Debug() *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Debug())
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) WithContext(ctx context.Context) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.WithContext(ctx))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) ReadDB() *fissionNotifyDo {
|
|
|
return f.Clauses(dbresolver.Read)
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) WriteDB() *fissionNotifyDo {
|
|
|
return f.Clauses(dbresolver.Write)
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Session(config *gorm.Session) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Session(config))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Clauses(conds ...clause.Expression) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Clauses(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Returning(value interface{}, columns ...string) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Returning(value, columns...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Not(conds ...gen.Condition) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Not(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Or(conds ...gen.Condition) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Or(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Select(conds ...field.Expr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Select(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Where(conds ...gen.Condition) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Where(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *fissionNotifyDo {
|
|
|
return f.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Order(conds ...field.Expr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Order(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Distinct(cols ...field.Expr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Distinct(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Omit(cols ...field.Expr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Omit(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Join(table schema.Tabler, on ...field.Expr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Join(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) LeftJoin(table schema.Tabler, on ...field.Expr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.LeftJoin(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) RightJoin(table schema.Tabler, on ...field.Expr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.RightJoin(table, on...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Group(cols ...field.Expr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Group(cols...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Having(conds ...gen.Condition) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Having(conds...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Limit(limit int) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Limit(limit))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Offset(offset int) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Offset(offset))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Scopes(funcs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Unscoped() *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Unscoped())
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Create(values ...*model.FissionNotify) error {
|
|
|
if len(values) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
return f.DO.Create(values)
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) CreateInBatches(values []*model.FissionNotify, 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 fissionNotifyDo) Save(values ...*model.FissionNotify) error {
|
|
|
if len(values) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
return f.DO.Save(values)
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) First() (*model.FissionNotify, error) {
|
|
|
if result, err := f.DO.First(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionNotify), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Take() (*model.FissionNotify, error) {
|
|
|
if result, err := f.DO.Take(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionNotify), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Last() (*model.FissionNotify, error) {
|
|
|
if result, err := f.DO.Last(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionNotify), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Find() ([]*model.FissionNotify, error) {
|
|
|
result, err := f.DO.Find()
|
|
|
return result.([]*model.FissionNotify), err
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FissionNotify, err error) {
|
|
|
buf := make([]*model.FissionNotify, 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 fissionNotifyDo) FindInBatches(result *[]*model.FissionNotify, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
|
return f.DO.FindInBatches(result, batchSize, fc)
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Attrs(attrs ...field.AssignExpr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Attrs(attrs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Assign(attrs ...field.AssignExpr) *fissionNotifyDo {
|
|
|
return f.withDO(f.DO.Assign(attrs...))
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Joins(fields ...field.RelationField) *fissionNotifyDo {
|
|
|
for _, _f := range fields {
|
|
|
f = *f.withDO(f.DO.Joins(_f))
|
|
|
}
|
|
|
return &f
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Preload(fields ...field.RelationField) *fissionNotifyDo {
|
|
|
for _, _f := range fields {
|
|
|
f = *f.withDO(f.DO.Preload(_f))
|
|
|
}
|
|
|
return &f
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) FirstOrInit() (*model.FissionNotify, error) {
|
|
|
if result, err := f.DO.FirstOrInit(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionNotify), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) FirstOrCreate() (*model.FissionNotify, error) {
|
|
|
if result, err := f.DO.FirstOrCreate(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
return result.(*model.FissionNotify), nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) FindByPage(offset int, limit int) (result []*model.FissionNotify, 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 fissionNotifyDo) 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 fissionNotifyDo) Scan(result interface{}) (err error) {
|
|
|
return f.DO.Scan(result)
|
|
|
}
|
|
|
|
|
|
func (f fissionNotifyDo) Delete(models ...*model.FissionNotify) (result gen.ResultInfo, err error) {
|
|
|
return f.DO.Delete(models)
|
|
|
}
|
|
|
|
|
|
func (f *fissionNotifyDo) withDO(do gen.Dao) *fissionNotifyDo {
|
|
|
f.DO = *do.(*gen.DO)
|
|
|
return f
|
|
|
}
|