464 lines
16 KiB
Go
464 lines
16 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 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 newSysAutoCodeHistory(db *gorm.DB, opts ...gen.DOOption) sysAutoCodeHistory {
|
|
_sysAutoCodeHistory := sysAutoCodeHistory{}
|
|
|
|
_sysAutoCodeHistory.sysAutoCodeHistoryDo.UseDB(db, opts...)
|
|
_sysAutoCodeHistory.sysAutoCodeHistoryDo.UseModel(&model.SysAutoCodeHistory{})
|
|
|
|
tableName := _sysAutoCodeHistory.sysAutoCodeHistoryDo.TableName()
|
|
_sysAutoCodeHistory.ALL = field.NewAsterisk(tableName)
|
|
_sysAutoCodeHistory.ID = field.NewInt64(tableName, "id")
|
|
_sysAutoCodeHistory.CreatedAt = field.NewTime(tableName, "created_at")
|
|
_sysAutoCodeHistory.UpdatedAt = field.NewTime(tableName, "updated_at")
|
|
_sysAutoCodeHistory.DeletedAt = field.NewField(tableName, "deleted_at")
|
|
_sysAutoCodeHistory.TblName = field.NewString(tableName, "table_name")
|
|
_sysAutoCodeHistory.Package = field.NewString(tableName, "package")
|
|
_sysAutoCodeHistory.Request = field.NewString(tableName, "request")
|
|
_sysAutoCodeHistory.StructName = field.NewString(tableName, "struct_name")
|
|
_sysAutoCodeHistory.Abbreviation = field.NewString(tableName, "abbreviation")
|
|
_sysAutoCodeHistory.BusinessDb = field.NewString(tableName, "business_db")
|
|
_sysAutoCodeHistory.Description = field.NewString(tableName, "description")
|
|
_sysAutoCodeHistory.Templates = field.NewString(tableName, "templates")
|
|
_sysAutoCodeHistory.Injections = field.NewString(tableName, "Injections")
|
|
_sysAutoCodeHistory.Flag = field.NewInt64(tableName, "flag")
|
|
_sysAutoCodeHistory.APIIds = field.NewString(tableName, "api_ids")
|
|
_sysAutoCodeHistory.MenuID = field.NewInt64(tableName, "menu_id")
|
|
_sysAutoCodeHistory.ExportTemplateID = field.NewInt64(tableName, "export_template_id")
|
|
_sysAutoCodeHistory.PackageID = field.NewInt64(tableName, "package_id")
|
|
|
|
_sysAutoCodeHistory.fillFieldMap()
|
|
|
|
return _sysAutoCodeHistory
|
|
}
|
|
|
|
type sysAutoCodeHistory struct {
|
|
sysAutoCodeHistoryDo sysAutoCodeHistoryDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Int64
|
|
CreatedAt field.Time
|
|
UpdatedAt field.Time
|
|
DeletedAt field.Field
|
|
TblName field.String // 表名
|
|
Package field.String // 模块名/插件名
|
|
Request field.String // 前端传入的结构化信息
|
|
StructName field.String // 结构体名称
|
|
Abbreviation field.String // 结构体名称缩写
|
|
BusinessDb field.String // 业务库
|
|
Description field.String // Struct中文名称
|
|
Templates field.String // 模板信息
|
|
Injections field.String // 注入路径
|
|
Flag field.Int64 // [0:创建,1:回滚]
|
|
APIIds field.String // api表注册内容
|
|
MenuID field.Int64 // 菜单ID
|
|
ExportTemplateID field.Int64 // 导出模板ID
|
|
PackageID field.Int64 // 包ID
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (s sysAutoCodeHistory) Table(newTableName string) *sysAutoCodeHistory {
|
|
s.sysAutoCodeHistoryDo.UseTable(newTableName)
|
|
return s.updateTableName(newTableName)
|
|
}
|
|
|
|
func (s sysAutoCodeHistory) As(alias string) *sysAutoCodeHistory {
|
|
s.sysAutoCodeHistoryDo.DO = *(s.sysAutoCodeHistoryDo.As(alias).(*gen.DO))
|
|
return s.updateTableName(alias)
|
|
}
|
|
|
|
func (s *sysAutoCodeHistory) updateTableName(table string) *sysAutoCodeHistory {
|
|
s.ALL = field.NewAsterisk(table)
|
|
s.ID = field.NewInt64(table, "id")
|
|
s.CreatedAt = field.NewTime(table, "created_at")
|
|
s.UpdatedAt = field.NewTime(table, "updated_at")
|
|
s.DeletedAt = field.NewField(table, "deleted_at")
|
|
s.TblName = field.NewString(table, "table_name")
|
|
s.Package = field.NewString(table, "package")
|
|
s.Request = field.NewString(table, "request")
|
|
s.StructName = field.NewString(table, "struct_name")
|
|
s.Abbreviation = field.NewString(table, "abbreviation")
|
|
s.BusinessDb = field.NewString(table, "business_db")
|
|
s.Description = field.NewString(table, "description")
|
|
s.Templates = field.NewString(table, "templates")
|
|
s.Injections = field.NewString(table, "Injections")
|
|
s.Flag = field.NewInt64(table, "flag")
|
|
s.APIIds = field.NewString(table, "api_ids")
|
|
s.MenuID = field.NewInt64(table, "menu_id")
|
|
s.ExportTemplateID = field.NewInt64(table, "export_template_id")
|
|
s.PackageID = field.NewInt64(table, "package_id")
|
|
|
|
s.fillFieldMap()
|
|
|
|
return s
|
|
}
|
|
|
|
func (s *sysAutoCodeHistory) WithContext(ctx context.Context) ISysAutoCodeHistoryDo {
|
|
return s.sysAutoCodeHistoryDo.WithContext(ctx)
|
|
}
|
|
|
|
func (s sysAutoCodeHistory) TableName() string { return s.sysAutoCodeHistoryDo.TableName() }
|
|
|
|
func (s sysAutoCodeHistory) Alias() string { return s.sysAutoCodeHistoryDo.Alias() }
|
|
|
|
func (s sysAutoCodeHistory) Columns(cols ...field.Expr) gen.Columns {
|
|
return s.sysAutoCodeHistoryDo.Columns(cols...)
|
|
}
|
|
|
|
func (s *sysAutoCodeHistory) 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 *sysAutoCodeHistory) fillFieldMap() {
|
|
s.fieldMap = make(map[string]field.Expr, 18)
|
|
s.fieldMap["id"] = s.ID
|
|
s.fieldMap["created_at"] = s.CreatedAt
|
|
s.fieldMap["updated_at"] = s.UpdatedAt
|
|
s.fieldMap["deleted_at"] = s.DeletedAt
|
|
s.fieldMap["table_name"] = s.TblName
|
|
s.fieldMap["package"] = s.Package
|
|
s.fieldMap["request"] = s.Request
|
|
s.fieldMap["struct_name"] = s.StructName
|
|
s.fieldMap["abbreviation"] = s.Abbreviation
|
|
s.fieldMap["business_db"] = s.BusinessDb
|
|
s.fieldMap["description"] = s.Description
|
|
s.fieldMap["templates"] = s.Templates
|
|
s.fieldMap["Injections"] = s.Injections
|
|
s.fieldMap["flag"] = s.Flag
|
|
s.fieldMap["api_ids"] = s.APIIds
|
|
s.fieldMap["menu_id"] = s.MenuID
|
|
s.fieldMap["export_template_id"] = s.ExportTemplateID
|
|
s.fieldMap["package_id"] = s.PackageID
|
|
}
|
|
|
|
func (s sysAutoCodeHistory) clone(db *gorm.DB) sysAutoCodeHistory {
|
|
s.sysAutoCodeHistoryDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return s
|
|
}
|
|
|
|
func (s sysAutoCodeHistory) replaceDB(db *gorm.DB) sysAutoCodeHistory {
|
|
s.sysAutoCodeHistoryDo.ReplaceDB(db)
|
|
return s
|
|
}
|
|
|
|
type sysAutoCodeHistoryDo struct{ gen.DO }
|
|
|
|
type ISysAutoCodeHistoryDo interface {
|
|
gen.SubQuery
|
|
Debug() ISysAutoCodeHistoryDo
|
|
WithContext(ctx context.Context) ISysAutoCodeHistoryDo
|
|
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
|
ReplaceDB(db *gorm.DB)
|
|
ReadDB() ISysAutoCodeHistoryDo
|
|
WriteDB() ISysAutoCodeHistoryDo
|
|
As(alias string) gen.Dao
|
|
Session(config *gorm.Session) ISysAutoCodeHistoryDo
|
|
Columns(cols ...field.Expr) gen.Columns
|
|
Clauses(conds ...clause.Expression) ISysAutoCodeHistoryDo
|
|
Not(conds ...gen.Condition) ISysAutoCodeHistoryDo
|
|
Or(conds ...gen.Condition) ISysAutoCodeHistoryDo
|
|
Select(conds ...field.Expr) ISysAutoCodeHistoryDo
|
|
Where(conds ...gen.Condition) ISysAutoCodeHistoryDo
|
|
Order(conds ...field.Expr) ISysAutoCodeHistoryDo
|
|
Distinct(cols ...field.Expr) ISysAutoCodeHistoryDo
|
|
Omit(cols ...field.Expr) ISysAutoCodeHistoryDo
|
|
Join(table schema.Tabler, on ...field.Expr) ISysAutoCodeHistoryDo
|
|
LeftJoin(table schema.Tabler, on ...field.Expr) ISysAutoCodeHistoryDo
|
|
RightJoin(table schema.Tabler, on ...field.Expr) ISysAutoCodeHistoryDo
|
|
Group(cols ...field.Expr) ISysAutoCodeHistoryDo
|
|
Having(conds ...gen.Condition) ISysAutoCodeHistoryDo
|
|
Limit(limit int) ISysAutoCodeHistoryDo
|
|
Offset(offset int) ISysAutoCodeHistoryDo
|
|
Count() (count int64, err error)
|
|
Scopes(funcs ...func(gen.Dao) gen.Dao) ISysAutoCodeHistoryDo
|
|
Unscoped() ISysAutoCodeHistoryDo
|
|
Create(values ...*model.SysAutoCodeHistory) error
|
|
CreateInBatches(values []*model.SysAutoCodeHistory, batchSize int) error
|
|
Save(values ...*model.SysAutoCodeHistory) error
|
|
First() (*model.SysAutoCodeHistory, error)
|
|
Take() (*model.SysAutoCodeHistory, error)
|
|
Last() (*model.SysAutoCodeHistory, error)
|
|
Find() ([]*model.SysAutoCodeHistory, error)
|
|
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SysAutoCodeHistory, err error)
|
|
FindInBatches(result *[]*model.SysAutoCodeHistory, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
|
Pluck(column field.Expr, dest interface{}) error
|
|
Delete(...*model.SysAutoCodeHistory) (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) ISysAutoCodeHistoryDo
|
|
Assign(attrs ...field.AssignExpr) ISysAutoCodeHistoryDo
|
|
Joins(fields ...field.RelationField) ISysAutoCodeHistoryDo
|
|
Preload(fields ...field.RelationField) ISysAutoCodeHistoryDo
|
|
FirstOrInit() (*model.SysAutoCodeHistory, error)
|
|
FirstOrCreate() (*model.SysAutoCodeHistory, error)
|
|
FindByPage(offset int, limit int) (result []*model.SysAutoCodeHistory, 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) ISysAutoCodeHistoryDo
|
|
UnderlyingDB() *gorm.DB
|
|
schema.Tabler
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Debug() ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Debug())
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) WithContext(ctx context.Context) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) ReadDB() ISysAutoCodeHistoryDo {
|
|
return s.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) WriteDB() ISysAutoCodeHistoryDo {
|
|
return s.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Session(config *gorm.Session) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Session(config))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Clauses(conds ...clause.Expression) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Returning(value interface{}, columns ...string) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Not(conds ...gen.Condition) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Not(conds...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Or(conds ...gen.Condition) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Or(conds...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Select(conds ...field.Expr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Select(conds...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Where(conds ...gen.Condition) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Where(conds...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Order(conds ...field.Expr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Order(conds...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Distinct(cols ...field.Expr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Omit(cols ...field.Expr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Omit(cols...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Join(table schema.Tabler, on ...field.Expr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Join(table, on...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) LeftJoin(table schema.Tabler, on ...field.Expr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) RightJoin(table schema.Tabler, on ...field.Expr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Group(cols ...field.Expr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Group(cols...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Having(conds ...gen.Condition) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Having(conds...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Limit(limit int) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Limit(limit))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Offset(offset int) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Offset(offset))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Unscoped() ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Unscoped())
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Create(values ...*model.SysAutoCodeHistory) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return s.DO.Create(values)
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) CreateInBatches(values []*model.SysAutoCodeHistory, 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 sysAutoCodeHistoryDo) Save(values ...*model.SysAutoCodeHistory) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return s.DO.Save(values)
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) First() (*model.SysAutoCodeHistory, error) {
|
|
if result, err := s.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysAutoCodeHistory), nil
|
|
}
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Take() (*model.SysAutoCodeHistory, error) {
|
|
if result, err := s.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysAutoCodeHistory), nil
|
|
}
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Last() (*model.SysAutoCodeHistory, error) {
|
|
if result, err := s.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysAutoCodeHistory), nil
|
|
}
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Find() ([]*model.SysAutoCodeHistory, error) {
|
|
result, err := s.DO.Find()
|
|
return result.([]*model.SysAutoCodeHistory), err
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SysAutoCodeHistory, err error) {
|
|
buf := make([]*model.SysAutoCodeHistory, 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 sysAutoCodeHistoryDo) FindInBatches(result *[]*model.SysAutoCodeHistory, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return s.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Attrs(attrs ...field.AssignExpr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Assign(attrs ...field.AssignExpr) ISysAutoCodeHistoryDo {
|
|
return s.withDO(s.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Joins(fields ...field.RelationField) ISysAutoCodeHistoryDo {
|
|
for _, _f := range fields {
|
|
s = *s.withDO(s.DO.Joins(_f))
|
|
}
|
|
return &s
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Preload(fields ...field.RelationField) ISysAutoCodeHistoryDo {
|
|
for _, _f := range fields {
|
|
s = *s.withDO(s.DO.Preload(_f))
|
|
}
|
|
return &s
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) FirstOrInit() (*model.SysAutoCodeHistory, error) {
|
|
if result, err := s.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysAutoCodeHistory), nil
|
|
}
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) FirstOrCreate() (*model.SysAutoCodeHistory, error) {
|
|
if result, err := s.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysAutoCodeHistory), nil
|
|
}
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) FindByPage(offset int, limit int) (result []*model.SysAutoCodeHistory, 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 sysAutoCodeHistoryDo) 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 sysAutoCodeHistoryDo) Scan(result interface{}) (err error) {
|
|
return s.DO.Scan(result)
|
|
}
|
|
|
|
func (s sysAutoCodeHistoryDo) Delete(models ...*model.SysAutoCodeHistory) (result gen.ResultInfo, err error) {
|
|
return s.DO.Delete(models)
|
|
}
|
|
|
|
func (s *sysAutoCodeHistoryDo) withDO(do gen.Dao) *sysAutoCodeHistoryDo {
|
|
s.DO = *do.(*gen.DO)
|
|
return s
|
|
}
|