345 lines
9.7 KiB
Go
Executable File
345 lines
9.7 KiB
Go
Executable File
// 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 newDouyinBlacklist(db *gorm.DB, opts ...gen.DOOption) douyinBlacklist {
|
|
_douyinBlacklist := douyinBlacklist{}
|
|
|
|
_douyinBlacklist.douyinBlacklistDo.UseDB(db, opts...)
|
|
_douyinBlacklist.douyinBlacklistDo.UseModel(&model.DouyinBlacklist{})
|
|
|
|
tableName := _douyinBlacklist.douyinBlacklistDo.TableName()
|
|
_douyinBlacklist.ALL = field.NewAsterisk(tableName)
|
|
_douyinBlacklist.ID = field.NewInt64(tableName, "id")
|
|
_douyinBlacklist.DouyinUserID = field.NewString(tableName, "douyin_user_id")
|
|
_douyinBlacklist.Reason = field.NewString(tableName, "reason")
|
|
_douyinBlacklist.OperatorID = field.NewInt64(tableName, "operator_id")
|
|
_douyinBlacklist.Status = field.NewInt32(tableName, "status")
|
|
_douyinBlacklist.CreatedAt = field.NewTime(tableName, "created_at")
|
|
_douyinBlacklist.UpdatedAt = field.NewTime(tableName, "updated_at")
|
|
|
|
_douyinBlacklist.fillFieldMap()
|
|
|
|
return _douyinBlacklist
|
|
}
|
|
|
|
// douyinBlacklist 抖音用户黑名单表
|
|
type douyinBlacklist struct {
|
|
douyinBlacklistDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Int64 // 主键ID
|
|
DouyinUserID field.String // 抖音用户ID
|
|
Reason field.String // 拉黑原因
|
|
OperatorID field.Int64 // 操作人ID
|
|
Status field.Int32 // 状态: 1=生效, 0=已解除
|
|
CreatedAt field.Time // 创建时间
|
|
UpdatedAt field.Time // 更新时间
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (d douyinBlacklist) Table(newTableName string) *douyinBlacklist {
|
|
d.douyinBlacklistDo.UseTable(newTableName)
|
|
return d.updateTableName(newTableName)
|
|
}
|
|
|
|
func (d douyinBlacklist) As(alias string) *douyinBlacklist {
|
|
d.douyinBlacklistDo.DO = *(d.douyinBlacklistDo.As(alias).(*gen.DO))
|
|
return d.updateTableName(alias)
|
|
}
|
|
|
|
func (d *douyinBlacklist) updateTableName(table string) *douyinBlacklist {
|
|
d.ALL = field.NewAsterisk(table)
|
|
d.ID = field.NewInt64(table, "id")
|
|
d.DouyinUserID = field.NewString(table, "douyin_user_id")
|
|
d.Reason = field.NewString(table, "reason")
|
|
d.OperatorID = field.NewInt64(table, "operator_id")
|
|
d.Status = field.NewInt32(table, "status")
|
|
d.CreatedAt = field.NewTime(table, "created_at")
|
|
d.UpdatedAt = field.NewTime(table, "updated_at")
|
|
|
|
d.fillFieldMap()
|
|
|
|
return d
|
|
}
|
|
|
|
func (d *douyinBlacklist) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|
_f, ok := d.fieldMap[fieldName]
|
|
if !ok || _f == nil {
|
|
return nil, false
|
|
}
|
|
_oe, ok := _f.(field.OrderExpr)
|
|
return _oe, ok
|
|
}
|
|
|
|
func (d *douyinBlacklist) fillFieldMap() {
|
|
d.fieldMap = make(map[string]field.Expr, 7)
|
|
d.fieldMap["id"] = d.ID
|
|
d.fieldMap["douyin_user_id"] = d.DouyinUserID
|
|
d.fieldMap["reason"] = d.Reason
|
|
d.fieldMap["operator_id"] = d.OperatorID
|
|
d.fieldMap["status"] = d.Status
|
|
d.fieldMap["created_at"] = d.CreatedAt
|
|
d.fieldMap["updated_at"] = d.UpdatedAt
|
|
}
|
|
|
|
func (d douyinBlacklist) clone(db *gorm.DB) douyinBlacklist {
|
|
d.douyinBlacklistDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return d
|
|
}
|
|
|
|
func (d douyinBlacklist) replaceDB(db *gorm.DB) douyinBlacklist {
|
|
d.douyinBlacklistDo.ReplaceDB(db)
|
|
return d
|
|
}
|
|
|
|
type douyinBlacklistDo struct{ gen.DO }
|
|
|
|
func (d douyinBlacklistDo) Debug() *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Debug())
|
|
}
|
|
|
|
func (d douyinBlacklistDo) WithContext(ctx context.Context) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) ReadDB() *douyinBlacklistDo {
|
|
return d.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (d douyinBlacklistDo) WriteDB() *douyinBlacklistDo {
|
|
return d.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Session(config *gorm.Session) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Session(config))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Clauses(conds ...clause.Expression) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Returning(value interface{}, columns ...string) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Not(conds ...gen.Condition) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Not(conds...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Or(conds ...gen.Condition) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Or(conds...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Select(conds ...field.Expr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Select(conds...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Where(conds ...gen.Condition) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Where(conds...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Order(conds ...field.Expr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Order(conds...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Distinct(cols ...field.Expr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Omit(cols ...field.Expr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Omit(cols...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Join(table schema.Tabler, on ...field.Expr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Join(table, on...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) LeftJoin(table schema.Tabler, on ...field.Expr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) RightJoin(table schema.Tabler, on ...field.Expr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Group(cols ...field.Expr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Group(cols...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Having(conds ...gen.Condition) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Having(conds...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Limit(limit int) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Limit(limit))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Offset(offset int) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Offset(offset))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Unscoped() *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Unscoped())
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Create(values ...*model.DouyinBlacklist) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return d.DO.Create(values)
|
|
}
|
|
|
|
func (d douyinBlacklistDo) CreateInBatches(values []*model.DouyinBlacklist, batchSize int) error {
|
|
return d.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 (d douyinBlacklistDo) Save(values ...*model.DouyinBlacklist) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return d.DO.Save(values)
|
|
}
|
|
|
|
func (d douyinBlacklistDo) First() (*model.DouyinBlacklist, error) {
|
|
if result, err := d.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.DouyinBlacklist), nil
|
|
}
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Take() (*model.DouyinBlacklist, error) {
|
|
if result, err := d.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.DouyinBlacklist), nil
|
|
}
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Last() (*model.DouyinBlacklist, error) {
|
|
if result, err := d.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.DouyinBlacklist), nil
|
|
}
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Find() ([]*model.DouyinBlacklist, error) {
|
|
result, err := d.DO.Find()
|
|
return result.([]*model.DouyinBlacklist), err
|
|
}
|
|
|
|
func (d douyinBlacklistDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.DouyinBlacklist, err error) {
|
|
buf := make([]*model.DouyinBlacklist, 0, batchSize)
|
|
err = d.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 (d douyinBlacklistDo) FindInBatches(result *[]*model.DouyinBlacklist, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return d.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Attrs(attrs ...field.AssignExpr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Assign(attrs ...field.AssignExpr) *douyinBlacklistDo {
|
|
return d.withDO(d.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Joins(fields ...field.RelationField) *douyinBlacklistDo {
|
|
for _, _f := range fields {
|
|
d = *d.withDO(d.DO.Joins(_f))
|
|
}
|
|
return &d
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Preload(fields ...field.RelationField) *douyinBlacklistDo {
|
|
for _, _f := range fields {
|
|
d = *d.withDO(d.DO.Preload(_f))
|
|
}
|
|
return &d
|
|
}
|
|
|
|
func (d douyinBlacklistDo) FirstOrInit() (*model.DouyinBlacklist, error) {
|
|
if result, err := d.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.DouyinBlacklist), nil
|
|
}
|
|
}
|
|
|
|
func (d douyinBlacklistDo) FirstOrCreate() (*model.DouyinBlacklist, error) {
|
|
if result, err := d.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.DouyinBlacklist), nil
|
|
}
|
|
}
|
|
|
|
func (d douyinBlacklistDo) FindByPage(offset int, limit int) (result []*model.DouyinBlacklist, count int64, err error) {
|
|
result, err = d.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 = d.Offset(-1).Limit(-1).Count()
|
|
return
|
|
}
|
|
|
|
func (d douyinBlacklistDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
|
count, err = d.Count()
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
err = d.Offset(offset).Limit(limit).Scan(result)
|
|
return
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Scan(result interface{}) (err error) {
|
|
return d.DO.Scan(result)
|
|
}
|
|
|
|
func (d douyinBlacklistDo) Delete(models ...*model.DouyinBlacklist) (result gen.ResultInfo, err error) {
|
|
return d.DO.Delete(models)
|
|
}
|
|
|
|
func (d *douyinBlacklistDo) withDO(do gen.Dao) *douyinBlacklistDo {
|
|
d.DO = *do.(*gen.DO)
|
|
return d
|
|
}
|