Files
servicebase/pkg/repo/admin_role_privilege.gen.go
2025-11-18 17:48:20 +08:00

430 lines
14 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"
"servicebase/pkg/model"
)
func newAdminRolePrivilege(db *gorm.DB, opts ...gen.DOOption) adminRolePrivilege {
_adminRolePrivilege := adminRolePrivilege{}
_adminRolePrivilege.adminRolePrivilegeDo.UseDB(db, opts...)
_adminRolePrivilege.adminRolePrivilegeDo.UseModel(&model.AdminRolePrivilege{})
tableName := _adminRolePrivilege.adminRolePrivilegeDo.TableName()
_adminRolePrivilege.ALL = field.NewAsterisk(tableName)
_adminRolePrivilege.ID = field.NewString(tableName, "id")
_adminRolePrivilege.TenantID = field.NewString(tableName, "tenant_id")
_adminRolePrivilege.ScopeID = field.NewString(tableName, "scope_id")
_adminRolePrivilege.RoleID = field.NewString(tableName, "role_id")
_adminRolePrivilege.PrivilegeID = field.NewString(tableName, "privilege_id")
_adminRolePrivilege.DeleteAt = field.NewField(tableName, "delete_at")
_adminRolePrivilege.CreateAt = field.NewTime(tableName, "create_at")
_adminRolePrivilege.CreateBy = field.NewString(tableName, "create_by")
_adminRolePrivilege.UpdateAt = field.NewTime(tableName, "update_at")
_adminRolePrivilege.UpdateBy = field.NewString(tableName, "update_by")
_adminRolePrivilege.fillFieldMap()
return _adminRolePrivilege
}
// adminRolePrivilege 租户角色-权限表
type adminRolePrivilege struct {
adminRolePrivilegeDo adminRolePrivilegeDo
ALL field.Asterisk
ID field.String // 业务ID
TenantID field.String // 企业ID
ScopeID field.String // 范围
RoleID field.String // 角色ID
PrivilegeID field.String // 权限ID
DeleteAt field.Field // del标志
CreateAt field.Time // 创建时间
CreateBy field.String // 创建人
UpdateAt field.Time // 更新时间
UpdateBy field.String // 更新人
fieldMap map[string]field.Expr
}
func (a adminRolePrivilege) Table(newTableName string) *adminRolePrivilege {
a.adminRolePrivilegeDo.UseTable(newTableName)
return a.updateTableName(newTableName)
}
func (a adminRolePrivilege) As(alias string) *adminRolePrivilege {
a.adminRolePrivilegeDo.DO = *(a.adminRolePrivilegeDo.As(alias).(*gen.DO))
return a.updateTableName(alias)
}
func (a *adminRolePrivilege) updateTableName(table string) *adminRolePrivilege {
a.ALL = field.NewAsterisk(table)
a.ID = field.NewString(table, "id")
a.TenantID = field.NewString(table, "tenant_id")
a.ScopeID = field.NewString(table, "scope_id")
a.RoleID = field.NewString(table, "role_id")
a.PrivilegeID = field.NewString(table, "privilege_id")
a.DeleteAt = field.NewField(table, "delete_at")
a.CreateAt = field.NewTime(table, "create_at")
a.CreateBy = field.NewString(table, "create_by")
a.UpdateAt = field.NewTime(table, "update_at")
a.UpdateBy = field.NewString(table, "update_by")
a.fillFieldMap()
return a
}
func (a *adminRolePrivilege) WithContext(ctx context.Context) IAdminRolePrivilegeDo {
return a.adminRolePrivilegeDo.WithContext(ctx)
}
func (a adminRolePrivilege) TableName() string { return a.adminRolePrivilegeDo.TableName() }
func (a adminRolePrivilege) Alias() string { return a.adminRolePrivilegeDo.Alias() }
func (a adminRolePrivilege) Columns(cols ...field.Expr) gen.Columns {
return a.adminRolePrivilegeDo.Columns(cols...)
}
func (a *adminRolePrivilege) 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 *adminRolePrivilege) fillFieldMap() {
a.fieldMap = make(map[string]field.Expr, 10)
a.fieldMap["id"] = a.ID
a.fieldMap["tenant_id"] = a.TenantID
a.fieldMap["scope_id"] = a.ScopeID
a.fieldMap["role_id"] = a.RoleID
a.fieldMap["privilege_id"] = a.PrivilegeID
a.fieldMap["delete_at"] = a.DeleteAt
a.fieldMap["create_at"] = a.CreateAt
a.fieldMap["create_by"] = a.CreateBy
a.fieldMap["update_at"] = a.UpdateAt
a.fieldMap["update_by"] = a.UpdateBy
}
func (a adminRolePrivilege) clone(db *gorm.DB) adminRolePrivilege {
a.adminRolePrivilegeDo.ReplaceConnPool(db.Statement.ConnPool)
return a
}
func (a adminRolePrivilege) replaceDB(db *gorm.DB) adminRolePrivilege {
a.adminRolePrivilegeDo.ReplaceDB(db)
return a
}
type adminRolePrivilegeDo struct{ gen.DO }
type IAdminRolePrivilegeDo interface {
gen.SubQuery
Debug() IAdminRolePrivilegeDo
WithContext(ctx context.Context) IAdminRolePrivilegeDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IAdminRolePrivilegeDo
WriteDB() IAdminRolePrivilegeDo
As(alias string) gen.Dao
Session(config *gorm.Session) IAdminRolePrivilegeDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IAdminRolePrivilegeDo
Not(conds ...gen.Condition) IAdminRolePrivilegeDo
Or(conds ...gen.Condition) IAdminRolePrivilegeDo
Select(conds ...field.Expr) IAdminRolePrivilegeDo
Where(conds ...gen.Condition) IAdminRolePrivilegeDo
Order(conds ...field.Expr) IAdminRolePrivilegeDo
Distinct(cols ...field.Expr) IAdminRolePrivilegeDo
Omit(cols ...field.Expr) IAdminRolePrivilegeDo
Join(table schema.Tabler, on ...field.Expr) IAdminRolePrivilegeDo
LeftJoin(table schema.Tabler, on ...field.Expr) IAdminRolePrivilegeDo
RightJoin(table schema.Tabler, on ...field.Expr) IAdminRolePrivilegeDo
Group(cols ...field.Expr) IAdminRolePrivilegeDo
Having(conds ...gen.Condition) IAdminRolePrivilegeDo
Limit(limit int) IAdminRolePrivilegeDo
Offset(offset int) IAdminRolePrivilegeDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IAdminRolePrivilegeDo
Unscoped() IAdminRolePrivilegeDo
Create(values ...*model.AdminRolePrivilege) error
CreateInBatches(values []*model.AdminRolePrivilege, batchSize int) error
Save(values ...*model.AdminRolePrivilege) error
First() (*model.AdminRolePrivilege, error)
Take() (*model.AdminRolePrivilege, error)
Last() (*model.AdminRolePrivilege, error)
Find() ([]*model.AdminRolePrivilege, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AdminRolePrivilege, err error)
FindInBatches(result *[]*model.AdminRolePrivilege, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.AdminRolePrivilege) (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) IAdminRolePrivilegeDo
Assign(attrs ...field.AssignExpr) IAdminRolePrivilegeDo
Joins(fields ...field.RelationField) IAdminRolePrivilegeDo
Preload(fields ...field.RelationField) IAdminRolePrivilegeDo
FirstOrInit() (*model.AdminRolePrivilege, error)
FirstOrCreate() (*model.AdminRolePrivilege, error)
FindByPage(offset int, limit int) (result []*model.AdminRolePrivilege, 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) IAdminRolePrivilegeDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (a adminRolePrivilegeDo) Debug() IAdminRolePrivilegeDo {
return a.withDO(a.DO.Debug())
}
func (a adminRolePrivilegeDo) WithContext(ctx context.Context) IAdminRolePrivilegeDo {
return a.withDO(a.DO.WithContext(ctx))
}
func (a adminRolePrivilegeDo) ReadDB() IAdminRolePrivilegeDo {
return a.Clauses(dbresolver.Read)
}
func (a adminRolePrivilegeDo) WriteDB() IAdminRolePrivilegeDo {
return a.Clauses(dbresolver.Write)
}
func (a adminRolePrivilegeDo) Session(config *gorm.Session) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Session(config))
}
func (a adminRolePrivilegeDo) Clauses(conds ...clause.Expression) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Clauses(conds...))
}
func (a adminRolePrivilegeDo) Returning(value interface{}, columns ...string) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Returning(value, columns...))
}
func (a adminRolePrivilegeDo) Not(conds ...gen.Condition) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Not(conds...))
}
func (a adminRolePrivilegeDo) Or(conds ...gen.Condition) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Or(conds...))
}
func (a adminRolePrivilegeDo) Select(conds ...field.Expr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Select(conds...))
}
func (a adminRolePrivilegeDo) Where(conds ...gen.Condition) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Where(conds...))
}
func (a adminRolePrivilegeDo) Order(conds ...field.Expr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Order(conds...))
}
func (a adminRolePrivilegeDo) Distinct(cols ...field.Expr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Distinct(cols...))
}
func (a adminRolePrivilegeDo) Omit(cols ...field.Expr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Omit(cols...))
}
func (a adminRolePrivilegeDo) Join(table schema.Tabler, on ...field.Expr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Join(table, on...))
}
func (a adminRolePrivilegeDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.LeftJoin(table, on...))
}
func (a adminRolePrivilegeDo) RightJoin(table schema.Tabler, on ...field.Expr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.RightJoin(table, on...))
}
func (a adminRolePrivilegeDo) Group(cols ...field.Expr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Group(cols...))
}
func (a adminRolePrivilegeDo) Having(conds ...gen.Condition) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Having(conds...))
}
func (a adminRolePrivilegeDo) Limit(limit int) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Limit(limit))
}
func (a adminRolePrivilegeDo) Offset(offset int) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Offset(offset))
}
func (a adminRolePrivilegeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Scopes(funcs...))
}
func (a adminRolePrivilegeDo) Unscoped() IAdminRolePrivilegeDo {
return a.withDO(a.DO.Unscoped())
}
func (a adminRolePrivilegeDo) Create(values ...*model.AdminRolePrivilege) error {
if len(values) == 0 {
return nil
}
return a.DO.Create(values)
}
func (a adminRolePrivilegeDo) CreateInBatches(values []*model.AdminRolePrivilege, 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 adminRolePrivilegeDo) Save(values ...*model.AdminRolePrivilege) error {
if len(values) == 0 {
return nil
}
return a.DO.Save(values)
}
func (a adminRolePrivilegeDo) First() (*model.AdminRolePrivilege, error) {
if result, err := a.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.AdminRolePrivilege), nil
}
}
func (a adminRolePrivilegeDo) Take() (*model.AdminRolePrivilege, error) {
if result, err := a.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.AdminRolePrivilege), nil
}
}
func (a adminRolePrivilegeDo) Last() (*model.AdminRolePrivilege, error) {
if result, err := a.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.AdminRolePrivilege), nil
}
}
func (a adminRolePrivilegeDo) Find() ([]*model.AdminRolePrivilege, error) {
result, err := a.DO.Find()
return result.([]*model.AdminRolePrivilege), err
}
func (a adminRolePrivilegeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AdminRolePrivilege, err error) {
buf := make([]*model.AdminRolePrivilege, 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 adminRolePrivilegeDo) FindInBatches(result *[]*model.AdminRolePrivilege, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return a.DO.FindInBatches(result, batchSize, fc)
}
func (a adminRolePrivilegeDo) Attrs(attrs ...field.AssignExpr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Attrs(attrs...))
}
func (a adminRolePrivilegeDo) Assign(attrs ...field.AssignExpr) IAdminRolePrivilegeDo {
return a.withDO(a.DO.Assign(attrs...))
}
func (a adminRolePrivilegeDo) Joins(fields ...field.RelationField) IAdminRolePrivilegeDo {
for _, _f := range fields {
a = *a.withDO(a.DO.Joins(_f))
}
return &a
}
func (a adminRolePrivilegeDo) Preload(fields ...field.RelationField) IAdminRolePrivilegeDo {
for _, _f := range fields {
a = *a.withDO(a.DO.Preload(_f))
}
return &a
}
func (a adminRolePrivilegeDo) FirstOrInit() (*model.AdminRolePrivilege, error) {
if result, err := a.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.AdminRolePrivilege), nil
}
}
func (a adminRolePrivilegeDo) FirstOrCreate() (*model.AdminRolePrivilege, error) {
if result, err := a.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.AdminRolePrivilege), nil
}
}
func (a adminRolePrivilegeDo) FindByPage(offset int, limit int) (result []*model.AdminRolePrivilege, 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 adminRolePrivilegeDo) 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 adminRolePrivilegeDo) Scan(result interface{}) (err error) {
return a.DO.Scan(result)
}
func (a adminRolePrivilegeDo) Delete(models ...*model.AdminRolePrivilege) (result gen.ResultInfo, err error) {
return a.DO.Delete(models)
}
func (a *adminRolePrivilegeDo) withDO(do gen.Dao) *adminRolePrivilegeDo {
a.DO = *do.(*gen.DO)
return a
}