任务三
This commit is contained in:
@@ -0,0 +1,399 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"kra/internal/data/model"
|
||||
)
|
||||
|
||||
func newSysDataAuthorityID(db *gorm.DB, opts ...gen.DOOption) sysDataAuthorityID {
|
||||
_sysDataAuthorityID := sysDataAuthorityID{}
|
||||
|
||||
_sysDataAuthorityID.sysDataAuthorityIDDo.UseDB(db, opts...)
|
||||
_sysDataAuthorityID.sysDataAuthorityIDDo.UseModel(&model.SysDataAuthorityID{})
|
||||
|
||||
tableName := _sysDataAuthorityID.sysDataAuthorityIDDo.TableName()
|
||||
_sysDataAuthorityID.ALL = field.NewAsterisk(tableName)
|
||||
_sysDataAuthorityID.SysAuthorityAuthorityID = field.NewInt64(tableName, "sys_authority_authority_id")
|
||||
_sysDataAuthorityID.DataAuthorityIDAuthorityID = field.NewInt64(tableName, "data_authority_id_authority_id")
|
||||
|
||||
_sysDataAuthorityID.fillFieldMap()
|
||||
|
||||
return _sysDataAuthorityID
|
||||
}
|
||||
|
||||
type sysDataAuthorityID struct {
|
||||
sysDataAuthorityIDDo sysDataAuthorityIDDo
|
||||
|
||||
ALL field.Asterisk
|
||||
SysAuthorityAuthorityID field.Int64 // 角色ID
|
||||
DataAuthorityIDAuthorityID field.Int64 // 角色ID
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityID) Table(newTableName string) *sysDataAuthorityID {
|
||||
s.sysDataAuthorityIDDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityID) As(alias string) *sysDataAuthorityID {
|
||||
s.sysDataAuthorityIDDo.DO = *(s.sysDataAuthorityIDDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *sysDataAuthorityID) updateTableName(table string) *sysDataAuthorityID {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.SysAuthorityAuthorityID = field.NewInt64(table, "sys_authority_authority_id")
|
||||
s.DataAuthorityIDAuthorityID = field.NewInt64(table, "data_authority_id_authority_id")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *sysDataAuthorityID) WithContext(ctx context.Context) ISysDataAuthorityIDDo {
|
||||
return s.sysDataAuthorityIDDo.WithContext(ctx)
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityID) TableName() string { return s.sysDataAuthorityIDDo.TableName() }
|
||||
|
||||
func (s sysDataAuthorityID) Alias() string { return s.sysDataAuthorityIDDo.Alias() }
|
||||
|
||||
func (s sysDataAuthorityID) Columns(cols ...field.Expr) gen.Columns {
|
||||
return s.sysDataAuthorityIDDo.Columns(cols...)
|
||||
}
|
||||
|
||||
func (s *sysDataAuthorityID) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *sysDataAuthorityID) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 2)
|
||||
s.fieldMap["sys_authority_authority_id"] = s.SysAuthorityAuthorityID
|
||||
s.fieldMap["data_authority_id_authority_id"] = s.DataAuthorityIDAuthorityID
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityID) clone(db *gorm.DB) sysDataAuthorityID {
|
||||
s.sysDataAuthorityIDDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityID) replaceDB(db *gorm.DB) sysDataAuthorityID {
|
||||
s.sysDataAuthorityIDDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type sysDataAuthorityIDDo struct{ gen.DO }
|
||||
|
||||
type ISysDataAuthorityIDDo interface {
|
||||
gen.SubQuery
|
||||
Debug() ISysDataAuthorityIDDo
|
||||
WithContext(ctx context.Context) ISysDataAuthorityIDDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() ISysDataAuthorityIDDo
|
||||
WriteDB() ISysDataAuthorityIDDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) ISysDataAuthorityIDDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) ISysDataAuthorityIDDo
|
||||
Not(conds ...gen.Condition) ISysDataAuthorityIDDo
|
||||
Or(conds ...gen.Condition) ISysDataAuthorityIDDo
|
||||
Select(conds ...field.Expr) ISysDataAuthorityIDDo
|
||||
Where(conds ...gen.Condition) ISysDataAuthorityIDDo
|
||||
Order(conds ...field.Expr) ISysDataAuthorityIDDo
|
||||
Distinct(cols ...field.Expr) ISysDataAuthorityIDDo
|
||||
Omit(cols ...field.Expr) ISysDataAuthorityIDDo
|
||||
Join(table schema.Tabler, on ...field.Expr) ISysDataAuthorityIDDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) ISysDataAuthorityIDDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) ISysDataAuthorityIDDo
|
||||
Group(cols ...field.Expr) ISysDataAuthorityIDDo
|
||||
Having(conds ...gen.Condition) ISysDataAuthorityIDDo
|
||||
Limit(limit int) ISysDataAuthorityIDDo
|
||||
Offset(offset int) ISysDataAuthorityIDDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) ISysDataAuthorityIDDo
|
||||
Unscoped() ISysDataAuthorityIDDo
|
||||
Create(values ...*model.SysDataAuthorityID) error
|
||||
CreateInBatches(values []*model.SysDataAuthorityID, batchSize int) error
|
||||
Save(values ...*model.SysDataAuthorityID) error
|
||||
First() (*model.SysDataAuthorityID, error)
|
||||
Take() (*model.SysDataAuthorityID, error)
|
||||
Last() (*model.SysDataAuthorityID, error)
|
||||
Find() ([]*model.SysDataAuthorityID, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SysDataAuthorityID, err error)
|
||||
FindInBatches(result *[]*model.SysDataAuthorityID, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.SysDataAuthorityID) (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) ISysDataAuthorityIDDo
|
||||
Assign(attrs ...field.AssignExpr) ISysDataAuthorityIDDo
|
||||
Joins(fields ...field.RelationField) ISysDataAuthorityIDDo
|
||||
Preload(fields ...field.RelationField) ISysDataAuthorityIDDo
|
||||
FirstOrInit() (*model.SysDataAuthorityID, error)
|
||||
FirstOrCreate() (*model.SysDataAuthorityID, error)
|
||||
FindByPage(offset int, limit int) (result []*model.SysDataAuthorityID, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Rows() (*sql.Rows, error)
|
||||
Row() *sql.Row
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) ISysDataAuthorityIDDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Debug() ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) WithContext(ctx context.Context) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) ReadDB() ISysDataAuthorityIDDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) WriteDB() ISysDataAuthorityIDDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Session(config *gorm.Session) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Clauses(conds ...clause.Expression) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Returning(value interface{}, columns ...string) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Not(conds ...gen.Condition) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Or(conds ...gen.Condition) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Select(conds ...field.Expr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Where(conds ...gen.Condition) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Order(conds ...field.Expr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Distinct(cols ...field.Expr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Omit(cols ...field.Expr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Join(table schema.Tabler, on ...field.Expr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) LeftJoin(table schema.Tabler, on ...field.Expr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) RightJoin(table schema.Tabler, on ...field.Expr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Group(cols ...field.Expr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Having(conds ...gen.Condition) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Limit(limit int) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Offset(offset int) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Unscoped() ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Create(values ...*model.SysDataAuthorityID) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) CreateInBatches(values []*model.SysDataAuthorityID, batchSize int) error {
|
||||
return s.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 (s sysDataAuthorityIDDo) Save(values ...*model.SysDataAuthorityID) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) First() (*model.SysDataAuthorityID, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.SysDataAuthorityID), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Take() (*model.SysDataAuthorityID, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.SysDataAuthorityID), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Last() (*model.SysDataAuthorityID, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.SysDataAuthorityID), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Find() ([]*model.SysDataAuthorityID, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.SysDataAuthorityID), err
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SysDataAuthorityID, err error) {
|
||||
buf := make([]*model.SysDataAuthorityID, 0, batchSize)
|
||||
err = s.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 (s sysDataAuthorityIDDo) FindInBatches(result *[]*model.SysDataAuthorityID, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Attrs(attrs ...field.AssignExpr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Assign(attrs ...field.AssignExpr) ISysDataAuthorityIDDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Joins(fields ...field.RelationField) ISysDataAuthorityIDDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Preload(fields ...field.RelationField) ISysDataAuthorityIDDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) FirstOrInit() (*model.SysDataAuthorityID, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.SysDataAuthorityID), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) FirstOrCreate() (*model.SysDataAuthorityID, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.SysDataAuthorityID), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) FindByPage(offset int, limit int) (result []*model.SysDataAuthorityID, count int64, err error) {
|
||||
result, err = s.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 = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s sysDataAuthorityIDDo) Delete(models ...*model.SysDataAuthorityID) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *sysDataAuthorityIDDo) withDO(do gen.Dao) *sysDataAuthorityIDDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
||||
Reference in New Issue
Block a user