454 lines
15 KiB
Go
454 lines
15 KiB
Go
// 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 repo
|
||
|
||
import (
|
||
"context"
|
||
|
||
"gorm.io/gorm"
|
||
"gorm.io/gorm/clause"
|
||
"gorm.io/gorm/schema"
|
||
|
||
"gorm.io/gen"
|
||
"gorm.io/gen/field"
|
||
|
||
"gorm.io/plugin/dbresolver"
|
||
|
||
"gitea.ddegame.cn/open/servicebase/pkg/model"
|
||
)
|
||
|
||
func newUserGameRoleProp(db *gorm.DB, opts ...gen.DOOption) userGameRoleProp {
|
||
_userGameRoleProp := userGameRoleProp{}
|
||
|
||
_userGameRoleProp.userGameRolePropDo.UseDB(db, opts...)
|
||
_userGameRoleProp.userGameRolePropDo.UseModel(&model.UserGameRoleProp{})
|
||
|
||
tableName := _userGameRoleProp.userGameRolePropDo.TableName()
|
||
_userGameRoleProp.ALL = field.NewAsterisk(tableName)
|
||
_userGameRoleProp.ID = field.NewString(tableName, "id")
|
||
_userGameRoleProp.UserID = field.NewString(tableName, "user_id")
|
||
_userGameRoleProp.GameID = field.NewString(tableName, "game_id")
|
||
_userGameRoleProp.RoleID = field.NewString(tableName, "role_id")
|
||
_userGameRoleProp.Type = field.NewString(tableName, "type")
|
||
_userGameRoleProp.Title = field.NewString(tableName, "title")
|
||
_userGameRoleProp.Content = field.NewString(tableName, "content")
|
||
_userGameRoleProp.URL = field.NewString(tableName, "url")
|
||
_userGameRoleProp.Ext = field.NewString(tableName, "ext")
|
||
_userGameRoleProp.State = field.NewInt32(tableName, "state")
|
||
_userGameRoleProp.Sort = field.NewInt32(tableName, "sort")
|
||
_userGameRoleProp.DeleteAt = field.NewField(tableName, "delete_at")
|
||
_userGameRoleProp.CreateAt = field.NewTime(tableName, "create_at")
|
||
_userGameRoleProp.CreateBy = field.NewString(tableName, "create_by")
|
||
_userGameRoleProp.UpdateAt = field.NewTime(tableName, "update_at")
|
||
_userGameRoleProp.UpdateBy = field.NewString(tableName, "update_by")
|
||
|
||
_userGameRoleProp.fillFieldMap()
|
||
|
||
return _userGameRoleProp
|
||
}
|
||
|
||
// userGameRoleProp 用户的游戏角色属性
|
||
type userGameRoleProp struct {
|
||
userGameRolePropDo userGameRolePropDo
|
||
|
||
ALL field.Asterisk
|
||
ID field.String // 业务ID
|
||
UserID field.String // 用户ID
|
||
GameID field.String // 游戏
|
||
RoleID field.String // 角色ID,user_game_role的ID
|
||
Type field.String // TEXT=文字 SKIN=皮肤
|
||
Title field.String // 标题
|
||
Content field.String // 内容
|
||
URL field.String // 链接
|
||
Ext field.String // 扩展字段
|
||
State field.Int32 // 状态1=启用 2=禁用
|
||
Sort field.Int32 // 排序
|
||
DeleteAt field.Field // del标志
|
||
CreateAt field.Time // 创建时间
|
||
CreateBy field.String // 创建人
|
||
UpdateAt field.Time // 更新时间
|
||
UpdateBy field.String // 更新人
|
||
|
||
fieldMap map[string]field.Expr
|
||
}
|
||
|
||
func (u userGameRoleProp) Table(newTableName string) *userGameRoleProp {
|
||
u.userGameRolePropDo.UseTable(newTableName)
|
||
return u.updateTableName(newTableName)
|
||
}
|
||
|
||
func (u userGameRoleProp) As(alias string) *userGameRoleProp {
|
||
u.userGameRolePropDo.DO = *(u.userGameRolePropDo.As(alias).(*gen.DO))
|
||
return u.updateTableName(alias)
|
||
}
|
||
|
||
func (u *userGameRoleProp) updateTableName(table string) *userGameRoleProp {
|
||
u.ALL = field.NewAsterisk(table)
|
||
u.ID = field.NewString(table, "id")
|
||
u.UserID = field.NewString(table, "user_id")
|
||
u.GameID = field.NewString(table, "game_id")
|
||
u.RoleID = field.NewString(table, "role_id")
|
||
u.Type = field.NewString(table, "type")
|
||
u.Title = field.NewString(table, "title")
|
||
u.Content = field.NewString(table, "content")
|
||
u.URL = field.NewString(table, "url")
|
||
u.Ext = field.NewString(table, "ext")
|
||
u.State = field.NewInt32(table, "state")
|
||
u.Sort = field.NewInt32(table, "sort")
|
||
u.DeleteAt = field.NewField(table, "delete_at")
|
||
u.CreateAt = field.NewTime(table, "create_at")
|
||
u.CreateBy = field.NewString(table, "create_by")
|
||
u.UpdateAt = field.NewTime(table, "update_at")
|
||
u.UpdateBy = field.NewString(table, "update_by")
|
||
|
||
u.fillFieldMap()
|
||
|
||
return u
|
||
}
|
||
|
||
func (u *userGameRoleProp) WithContext(ctx context.Context) IUserGameRolePropDo {
|
||
return u.userGameRolePropDo.WithContext(ctx)
|
||
}
|
||
|
||
func (u userGameRoleProp) TableName() string { return u.userGameRolePropDo.TableName() }
|
||
|
||
func (u userGameRoleProp) Alias() string { return u.userGameRolePropDo.Alias() }
|
||
|
||
func (u userGameRoleProp) Columns(cols ...field.Expr) gen.Columns {
|
||
return u.userGameRolePropDo.Columns(cols...)
|
||
}
|
||
|
||
func (u *userGameRoleProp) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||
_f, ok := u.fieldMap[fieldName]
|
||
if !ok || _f == nil {
|
||
return nil, false
|
||
}
|
||
_oe, ok := _f.(field.OrderExpr)
|
||
return _oe, ok
|
||
}
|
||
|
||
func (u *userGameRoleProp) fillFieldMap() {
|
||
u.fieldMap = make(map[string]field.Expr, 16)
|
||
u.fieldMap["id"] = u.ID
|
||
u.fieldMap["user_id"] = u.UserID
|
||
u.fieldMap["game_id"] = u.GameID
|
||
u.fieldMap["role_id"] = u.RoleID
|
||
u.fieldMap["type"] = u.Type
|
||
u.fieldMap["title"] = u.Title
|
||
u.fieldMap["content"] = u.Content
|
||
u.fieldMap["url"] = u.URL
|
||
u.fieldMap["ext"] = u.Ext
|
||
u.fieldMap["state"] = u.State
|
||
u.fieldMap["sort"] = u.Sort
|
||
u.fieldMap["delete_at"] = u.DeleteAt
|
||
u.fieldMap["create_at"] = u.CreateAt
|
||
u.fieldMap["create_by"] = u.CreateBy
|
||
u.fieldMap["update_at"] = u.UpdateAt
|
||
u.fieldMap["update_by"] = u.UpdateBy
|
||
}
|
||
|
||
func (u userGameRoleProp) clone(db *gorm.DB) userGameRoleProp {
|
||
u.userGameRolePropDo.ReplaceConnPool(db.Statement.ConnPool)
|
||
return u
|
||
}
|
||
|
||
func (u userGameRoleProp) replaceDB(db *gorm.DB) userGameRoleProp {
|
||
u.userGameRolePropDo.ReplaceDB(db)
|
||
return u
|
||
}
|
||
|
||
type userGameRolePropDo struct{ gen.DO }
|
||
|
||
type IUserGameRolePropDo interface {
|
||
gen.SubQuery
|
||
Debug() IUserGameRolePropDo
|
||
WithContext(ctx context.Context) IUserGameRolePropDo
|
||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||
ReplaceDB(db *gorm.DB)
|
||
ReadDB() IUserGameRolePropDo
|
||
WriteDB() IUserGameRolePropDo
|
||
As(alias string) gen.Dao
|
||
Session(config *gorm.Session) IUserGameRolePropDo
|
||
Columns(cols ...field.Expr) gen.Columns
|
||
Clauses(conds ...clause.Expression) IUserGameRolePropDo
|
||
Not(conds ...gen.Condition) IUserGameRolePropDo
|
||
Or(conds ...gen.Condition) IUserGameRolePropDo
|
||
Select(conds ...field.Expr) IUserGameRolePropDo
|
||
Where(conds ...gen.Condition) IUserGameRolePropDo
|
||
Order(conds ...field.Expr) IUserGameRolePropDo
|
||
Distinct(cols ...field.Expr) IUserGameRolePropDo
|
||
Omit(cols ...field.Expr) IUserGameRolePropDo
|
||
Join(table schema.Tabler, on ...field.Expr) IUserGameRolePropDo
|
||
LeftJoin(table schema.Tabler, on ...field.Expr) IUserGameRolePropDo
|
||
RightJoin(table schema.Tabler, on ...field.Expr) IUserGameRolePropDo
|
||
Group(cols ...field.Expr) IUserGameRolePropDo
|
||
Having(conds ...gen.Condition) IUserGameRolePropDo
|
||
Limit(limit int) IUserGameRolePropDo
|
||
Offset(offset int) IUserGameRolePropDo
|
||
Count() (count int64, err error)
|
||
Scopes(funcs ...func(gen.Dao) gen.Dao) IUserGameRolePropDo
|
||
Unscoped() IUserGameRolePropDo
|
||
Create(values ...*model.UserGameRoleProp) error
|
||
CreateInBatches(values []*model.UserGameRoleProp, batchSize int) error
|
||
Save(values ...*model.UserGameRoleProp) error
|
||
First() (*model.UserGameRoleProp, error)
|
||
Take() (*model.UserGameRoleProp, error)
|
||
Last() (*model.UserGameRoleProp, error)
|
||
Find() ([]*model.UserGameRoleProp, error)
|
||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserGameRoleProp, err error)
|
||
FindInBatches(result *[]*model.UserGameRoleProp, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||
Pluck(column field.Expr, dest interface{}) error
|
||
Delete(...*model.UserGameRoleProp) (info gen.ResultInfo, err error)
|
||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||
Attrs(attrs ...field.AssignExpr) IUserGameRolePropDo
|
||
Assign(attrs ...field.AssignExpr) IUserGameRolePropDo
|
||
Joins(fields ...field.RelationField) IUserGameRolePropDo
|
||
Preload(fields ...field.RelationField) IUserGameRolePropDo
|
||
FirstOrInit() (*model.UserGameRoleProp, error)
|
||
FirstOrCreate() (*model.UserGameRoleProp, error)
|
||
FindByPage(offset int, limit int) (result []*model.UserGameRoleProp, count int64, err error)
|
||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||
Scan(result interface{}) (err error)
|
||
Returning(value interface{}, columns ...string) IUserGameRolePropDo
|
||
UnderlyingDB() *gorm.DB
|
||
schema.Tabler
|
||
}
|
||
|
||
func (u userGameRolePropDo) Debug() IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Debug())
|
||
}
|
||
|
||
func (u userGameRolePropDo) WithContext(ctx context.Context) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.WithContext(ctx))
|
||
}
|
||
|
||
func (u userGameRolePropDo) ReadDB() IUserGameRolePropDo {
|
||
return u.Clauses(dbresolver.Read)
|
||
}
|
||
|
||
func (u userGameRolePropDo) WriteDB() IUserGameRolePropDo {
|
||
return u.Clauses(dbresolver.Write)
|
||
}
|
||
|
||
func (u userGameRolePropDo) Session(config *gorm.Session) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Session(config))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Clauses(conds ...clause.Expression) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Clauses(conds...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Returning(value interface{}, columns ...string) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Returning(value, columns...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Not(conds ...gen.Condition) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Not(conds...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Or(conds ...gen.Condition) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Or(conds...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Select(conds ...field.Expr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Select(conds...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Where(conds ...gen.Condition) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Where(conds...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Order(conds ...field.Expr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Order(conds...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Distinct(cols ...field.Expr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Distinct(cols...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Omit(cols ...field.Expr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Omit(cols...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Join(table schema.Tabler, on ...field.Expr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Join(table, on...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.LeftJoin(table, on...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.RightJoin(table, on...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Group(cols ...field.Expr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Group(cols...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Having(conds ...gen.Condition) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Having(conds...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Limit(limit int) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Limit(limit))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Offset(offset int) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Offset(offset))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Scopes(funcs...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Unscoped() IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Unscoped())
|
||
}
|
||
|
||
func (u userGameRolePropDo) Create(values ...*model.UserGameRoleProp) error {
|
||
if len(values) == 0 {
|
||
return nil
|
||
}
|
||
return u.DO.Create(values)
|
||
}
|
||
|
||
func (u userGameRolePropDo) CreateInBatches(values []*model.UserGameRoleProp, batchSize int) error {
|
||
return u.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 (u userGameRolePropDo) Save(values ...*model.UserGameRoleProp) error {
|
||
if len(values) == 0 {
|
||
return nil
|
||
}
|
||
return u.DO.Save(values)
|
||
}
|
||
|
||
func (u userGameRolePropDo) First() (*model.UserGameRoleProp, error) {
|
||
if result, err := u.DO.First(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.UserGameRoleProp), nil
|
||
}
|
||
}
|
||
|
||
func (u userGameRolePropDo) Take() (*model.UserGameRoleProp, error) {
|
||
if result, err := u.DO.Take(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.UserGameRoleProp), nil
|
||
}
|
||
}
|
||
|
||
func (u userGameRolePropDo) Last() (*model.UserGameRoleProp, error) {
|
||
if result, err := u.DO.Last(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.UserGameRoleProp), nil
|
||
}
|
||
}
|
||
|
||
func (u userGameRolePropDo) Find() ([]*model.UserGameRoleProp, error) {
|
||
result, err := u.DO.Find()
|
||
return result.([]*model.UserGameRoleProp), err
|
||
}
|
||
|
||
func (u userGameRolePropDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserGameRoleProp, err error) {
|
||
buf := make([]*model.UserGameRoleProp, 0, batchSize)
|
||
err = u.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 (u userGameRolePropDo) FindInBatches(result *[]*model.UserGameRoleProp, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||
return u.DO.FindInBatches(result, batchSize, fc)
|
||
}
|
||
|
||
func (u userGameRolePropDo) Attrs(attrs ...field.AssignExpr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Attrs(attrs...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Assign(attrs ...field.AssignExpr) IUserGameRolePropDo {
|
||
return u.withDO(u.DO.Assign(attrs...))
|
||
}
|
||
|
||
func (u userGameRolePropDo) Joins(fields ...field.RelationField) IUserGameRolePropDo {
|
||
for _, _f := range fields {
|
||
u = *u.withDO(u.DO.Joins(_f))
|
||
}
|
||
return &u
|
||
}
|
||
|
||
func (u userGameRolePropDo) Preload(fields ...field.RelationField) IUserGameRolePropDo {
|
||
for _, _f := range fields {
|
||
u = *u.withDO(u.DO.Preload(_f))
|
||
}
|
||
return &u
|
||
}
|
||
|
||
func (u userGameRolePropDo) FirstOrInit() (*model.UserGameRoleProp, error) {
|
||
if result, err := u.DO.FirstOrInit(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.UserGameRoleProp), nil
|
||
}
|
||
}
|
||
|
||
func (u userGameRolePropDo) FirstOrCreate() (*model.UserGameRoleProp, error) {
|
||
if result, err := u.DO.FirstOrCreate(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.UserGameRoleProp), nil
|
||
}
|
||
}
|
||
|
||
func (u userGameRolePropDo) FindByPage(offset int, limit int) (result []*model.UserGameRoleProp, count int64, err error) {
|
||
result, err = u.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 = u.Offset(-1).Limit(-1).Count()
|
||
return
|
||
}
|
||
|
||
func (u userGameRolePropDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||
count, err = u.Count()
|
||
if err != nil {
|
||
return
|
||
}
|
||
|
||
err = u.Offset(offset).Limit(limit).Scan(result)
|
||
return
|
||
}
|
||
|
||
func (u userGameRolePropDo) Scan(result interface{}) (err error) {
|
||
return u.DO.Scan(result)
|
||
}
|
||
|
||
func (u userGameRolePropDo) Delete(models ...*model.UserGameRoleProp) (result gen.ResultInfo, err error) {
|
||
return u.DO.Delete(models)
|
||
}
|
||
|
||
func (u *userGameRolePropDo) withDO(do gen.Dao) *userGameRolePropDo {
|
||
u.DO = *do.(*gen.DO)
|
||
return u
|
||
}
|