rts-sim-testing-service/db/dbquery/auth_role_user.gen.go

389 lines
11 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 dbquery
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
"joylink.club/bj-rtsts-server/db/model"
)
func newAuthRoleUser(db *gorm.DB, opts ...gen.DOOption) authRoleUser {
_authRoleUser := authRoleUser{}
_authRoleUser.authRoleUserDo.UseDB(db, opts...)
_authRoleUser.authRoleUserDo.UseModel(&model.AuthRoleUser{})
tableName := _authRoleUser.authRoleUserDo.TableName()
_authRoleUser.ALL = field.NewAsterisk(tableName)
_authRoleUser.ID = field.NewInt32(tableName, "id")
_authRoleUser.Rid = field.NewInt32(tableName, "rid")
_authRoleUser.UID = field.NewInt32(tableName, "uid")
_authRoleUser.fillFieldMap()
return _authRoleUser
}
type authRoleUser struct {
authRoleUserDo
ALL field.Asterisk
ID field.Int32 // 主键
Rid field.Int32 // 角色ID
UID field.Int32 // 用户ID
fieldMap map[string]field.Expr
}
func (a authRoleUser) Table(newTableName string) *authRoleUser {
a.authRoleUserDo.UseTable(newTableName)
return a.updateTableName(newTableName)
}
func (a authRoleUser) As(alias string) *authRoleUser {
a.authRoleUserDo.DO = *(a.authRoleUserDo.As(alias).(*gen.DO))
return a.updateTableName(alias)
}
func (a *authRoleUser) updateTableName(table string) *authRoleUser {
a.ALL = field.NewAsterisk(table)
a.ID = field.NewInt32(table, "id")
a.Rid = field.NewInt32(table, "rid")
a.UID = field.NewInt32(table, "uid")
a.fillFieldMap()
return a
}
func (a *authRoleUser) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := a.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (a *authRoleUser) fillFieldMap() {
a.fieldMap = make(map[string]field.Expr, 3)
a.fieldMap["id"] = a.ID
a.fieldMap["rid"] = a.Rid
a.fieldMap["uid"] = a.UID
}
func (a authRoleUser) clone(db *gorm.DB) authRoleUser {
a.authRoleUserDo.ReplaceConnPool(db.Statement.ConnPool)
return a
}
func (a authRoleUser) replaceDB(db *gorm.DB) authRoleUser {
a.authRoleUserDo.ReplaceDB(db)
return a
}
type authRoleUserDo struct{ gen.DO }
type IAuthRoleUserDo interface {
gen.SubQuery
Debug() IAuthRoleUserDo
WithContext(ctx context.Context) IAuthRoleUserDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IAuthRoleUserDo
WriteDB() IAuthRoleUserDo
As(alias string) gen.Dao
Session(config *gorm.Session) IAuthRoleUserDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IAuthRoleUserDo
Not(conds ...gen.Condition) IAuthRoleUserDo
Or(conds ...gen.Condition) IAuthRoleUserDo
Select(conds ...field.Expr) IAuthRoleUserDo
Where(conds ...gen.Condition) IAuthRoleUserDo
Order(conds ...field.Expr) IAuthRoleUserDo
Distinct(cols ...field.Expr) IAuthRoleUserDo
Omit(cols ...field.Expr) IAuthRoleUserDo
Join(table schema.Tabler, on ...field.Expr) IAuthRoleUserDo
LeftJoin(table schema.Tabler, on ...field.Expr) IAuthRoleUserDo
RightJoin(table schema.Tabler, on ...field.Expr) IAuthRoleUserDo
Group(cols ...field.Expr) IAuthRoleUserDo
Having(conds ...gen.Condition) IAuthRoleUserDo
Limit(limit int) IAuthRoleUserDo
Offset(offset int) IAuthRoleUserDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IAuthRoleUserDo
Unscoped() IAuthRoleUserDo
Create(values ...*model.AuthRoleUser) error
CreateInBatches(values []*model.AuthRoleUser, batchSize int) error
Save(values ...*model.AuthRoleUser) error
First() (*model.AuthRoleUser, error)
Take() (*model.AuthRoleUser, error)
Last() (*model.AuthRoleUser, error)
Find() ([]*model.AuthRoleUser, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AuthRoleUser, err error)
FindInBatches(result *[]*model.AuthRoleUser, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.AuthRoleUser) (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) IAuthRoleUserDo
Assign(attrs ...field.AssignExpr) IAuthRoleUserDo
Joins(fields ...field.RelationField) IAuthRoleUserDo
Preload(fields ...field.RelationField) IAuthRoleUserDo
FirstOrInit() (*model.AuthRoleUser, error)
FirstOrCreate() (*model.AuthRoleUser, error)
FindByPage(offset int, limit int) (result []*model.AuthRoleUser, 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) IAuthRoleUserDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (a authRoleUserDo) Debug() IAuthRoleUserDo {
return a.withDO(a.DO.Debug())
}
func (a authRoleUserDo) WithContext(ctx context.Context) IAuthRoleUserDo {
return a.withDO(a.DO.WithContext(ctx))
}
func (a authRoleUserDo) ReadDB() IAuthRoleUserDo {
return a.Clauses(dbresolver.Read)
}
func (a authRoleUserDo) WriteDB() IAuthRoleUserDo {
return a.Clauses(dbresolver.Write)
}
func (a authRoleUserDo) Session(config *gorm.Session) IAuthRoleUserDo {
return a.withDO(a.DO.Session(config))
}
func (a authRoleUserDo) Clauses(conds ...clause.Expression) IAuthRoleUserDo {
return a.withDO(a.DO.Clauses(conds...))
}
func (a authRoleUserDo) Returning(value interface{}, columns ...string) IAuthRoleUserDo {
return a.withDO(a.DO.Returning(value, columns...))
}
func (a authRoleUserDo) Not(conds ...gen.Condition) IAuthRoleUserDo {
return a.withDO(a.DO.Not(conds...))
}
func (a authRoleUserDo) Or(conds ...gen.Condition) IAuthRoleUserDo {
return a.withDO(a.DO.Or(conds...))
}
func (a authRoleUserDo) Select(conds ...field.Expr) IAuthRoleUserDo {
return a.withDO(a.DO.Select(conds...))
}
func (a authRoleUserDo) Where(conds ...gen.Condition) IAuthRoleUserDo {
return a.withDO(a.DO.Where(conds...))
}
func (a authRoleUserDo) Order(conds ...field.Expr) IAuthRoleUserDo {
return a.withDO(a.DO.Order(conds...))
}
func (a authRoleUserDo) Distinct(cols ...field.Expr) IAuthRoleUserDo {
return a.withDO(a.DO.Distinct(cols...))
}
func (a authRoleUserDo) Omit(cols ...field.Expr) IAuthRoleUserDo {
return a.withDO(a.DO.Omit(cols...))
}
func (a authRoleUserDo) Join(table schema.Tabler, on ...field.Expr) IAuthRoleUserDo {
return a.withDO(a.DO.Join(table, on...))
}
func (a authRoleUserDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAuthRoleUserDo {
return a.withDO(a.DO.LeftJoin(table, on...))
}
func (a authRoleUserDo) RightJoin(table schema.Tabler, on ...field.Expr) IAuthRoleUserDo {
return a.withDO(a.DO.RightJoin(table, on...))
}
func (a authRoleUserDo) Group(cols ...field.Expr) IAuthRoleUserDo {
return a.withDO(a.DO.Group(cols...))
}
func (a authRoleUserDo) Having(conds ...gen.Condition) IAuthRoleUserDo {
return a.withDO(a.DO.Having(conds...))
}
func (a authRoleUserDo) Limit(limit int) IAuthRoleUserDo {
return a.withDO(a.DO.Limit(limit))
}
func (a authRoleUserDo) Offset(offset int) IAuthRoleUserDo {
return a.withDO(a.DO.Offset(offset))
}
func (a authRoleUserDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAuthRoleUserDo {
return a.withDO(a.DO.Scopes(funcs...))
}
func (a authRoleUserDo) Unscoped() IAuthRoleUserDo {
return a.withDO(a.DO.Unscoped())
}
func (a authRoleUserDo) Create(values ...*model.AuthRoleUser) error {
if len(values) == 0 {
return nil
}
return a.DO.Create(values)
}
func (a authRoleUserDo) CreateInBatches(values []*model.AuthRoleUser, batchSize int) error {
return a.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 (a authRoleUserDo) Save(values ...*model.AuthRoleUser) error {
if len(values) == 0 {
return nil
}
return a.DO.Save(values)
}
func (a authRoleUserDo) First() (*model.AuthRoleUser, error) {
if result, err := a.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.AuthRoleUser), nil
}
}
func (a authRoleUserDo) Take() (*model.AuthRoleUser, error) {
if result, err := a.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.AuthRoleUser), nil
}
}
func (a authRoleUserDo) Last() (*model.AuthRoleUser, error) {
if result, err := a.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.AuthRoleUser), nil
}
}
func (a authRoleUserDo) Find() ([]*model.AuthRoleUser, error) {
result, err := a.DO.Find()
return result.([]*model.AuthRoleUser), err
}
func (a authRoleUserDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AuthRoleUser, err error) {
buf := make([]*model.AuthRoleUser, 0, batchSize)
err = a.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 (a authRoleUserDo) FindInBatches(result *[]*model.AuthRoleUser, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return a.DO.FindInBatches(result, batchSize, fc)
}
func (a authRoleUserDo) Attrs(attrs ...field.AssignExpr) IAuthRoleUserDo {
return a.withDO(a.DO.Attrs(attrs...))
}
func (a authRoleUserDo) Assign(attrs ...field.AssignExpr) IAuthRoleUserDo {
return a.withDO(a.DO.Assign(attrs...))
}
func (a authRoleUserDo) Joins(fields ...field.RelationField) IAuthRoleUserDo {
for _, _f := range fields {
a = *a.withDO(a.DO.Joins(_f))
}
return &a
}
func (a authRoleUserDo) Preload(fields ...field.RelationField) IAuthRoleUserDo {
for _, _f := range fields {
a = *a.withDO(a.DO.Preload(_f))
}
return &a
}
func (a authRoleUserDo) FirstOrInit() (*model.AuthRoleUser, error) {
if result, err := a.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.AuthRoleUser), nil
}
}
func (a authRoleUserDo) FirstOrCreate() (*model.AuthRoleUser, error) {
if result, err := a.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.AuthRoleUser), nil
}
}
func (a authRoleUserDo) FindByPage(offset int, limit int) (result []*model.AuthRoleUser, count int64, err error) {
result, err = a.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 = a.Offset(-1).Limit(-1).Count()
return
}
func (a authRoleUserDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = a.Count()
if err != nil {
return
}
err = a.Offset(offset).Limit(limit).Scan(result)
return
}
func (a authRoleUserDo) Scan(result interface{}) (err error) {
return a.DO.Scan(result)
}
func (a authRoleUserDo) Delete(models ...*model.AuthRoleUser) (result gen.ResultInfo, err error) {
return a.DO.Delete(models)
}
func (a *authRoleUserDo) withDO(do gen.Dao) *authRoleUserDo {
a.DO = *do.(*gen.DO)
return a
}