424 lines
14 KiB
Go
424 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 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 newSysExportTemplateJoin(db *gorm.DB, opts ...gen.DOOption) sysExportTemplateJoin {
|
|
_sysExportTemplateJoin := sysExportTemplateJoin{}
|
|
|
|
_sysExportTemplateJoin.sysExportTemplateJoinDo.UseDB(db, opts...)
|
|
_sysExportTemplateJoin.sysExportTemplateJoinDo.UseModel(&model.SysExportTemplateJoin{})
|
|
|
|
tableName := _sysExportTemplateJoin.sysExportTemplateJoinDo.TableName()
|
|
_sysExportTemplateJoin.ALL = field.NewAsterisk(tableName)
|
|
_sysExportTemplateJoin.ID = field.NewInt64(tableName, "id")
|
|
_sysExportTemplateJoin.CreatedAt = field.NewTime(tableName, "created_at")
|
|
_sysExportTemplateJoin.UpdatedAt = field.NewTime(tableName, "updated_at")
|
|
_sysExportTemplateJoin.DeletedAt = field.NewField(tableName, "deleted_at")
|
|
_sysExportTemplateJoin.TemplateID = field.NewString(tableName, "template_id")
|
|
_sysExportTemplateJoin.Joins = field.NewString(tableName, "joins")
|
|
_sysExportTemplateJoin.TblName = field.NewString(tableName, "table")
|
|
_sysExportTemplateJoin.On = field.NewString(tableName, "on")
|
|
|
|
_sysExportTemplateJoin.fillFieldMap()
|
|
|
|
return _sysExportTemplateJoin
|
|
}
|
|
|
|
type sysExportTemplateJoin struct {
|
|
sysExportTemplateJoinDo sysExportTemplateJoinDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Int64
|
|
CreatedAt field.Time
|
|
UpdatedAt field.Time
|
|
DeletedAt field.Field
|
|
TemplateID field.String // 模板标识
|
|
Joins field.String // 关联
|
|
TblName field.String // 关联表
|
|
On field.String // 关联条件
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (s sysExportTemplateJoin) Table(newTableName string) *sysExportTemplateJoin {
|
|
s.sysExportTemplateJoinDo.UseTable(newTableName)
|
|
return s.updateTableName(newTableName)
|
|
}
|
|
|
|
func (s sysExportTemplateJoin) As(alias string) *sysExportTemplateJoin {
|
|
s.sysExportTemplateJoinDo.DO = *(s.sysExportTemplateJoinDo.As(alias).(*gen.DO))
|
|
return s.updateTableName(alias)
|
|
}
|
|
|
|
func (s *sysExportTemplateJoin) updateTableName(table string) *sysExportTemplateJoin {
|
|
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.TemplateID = field.NewString(table, "template_id")
|
|
s.Joins = field.NewString(table, "joins")
|
|
s.TblName = field.NewString(table, "table")
|
|
s.On = field.NewString(table, "on")
|
|
|
|
s.fillFieldMap()
|
|
|
|
return s
|
|
}
|
|
|
|
func (s *sysExportTemplateJoin) WithContext(ctx context.Context) ISysExportTemplateJoinDo {
|
|
return s.sysExportTemplateJoinDo.WithContext(ctx)
|
|
}
|
|
|
|
func (s sysExportTemplateJoin) TableName() string { return s.sysExportTemplateJoinDo.TableName() }
|
|
|
|
func (s sysExportTemplateJoin) Alias() string { return s.sysExportTemplateJoinDo.Alias() }
|
|
|
|
func (s sysExportTemplateJoin) Columns(cols ...field.Expr) gen.Columns {
|
|
return s.sysExportTemplateJoinDo.Columns(cols...)
|
|
}
|
|
|
|
func (s *sysExportTemplateJoin) 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 *sysExportTemplateJoin) fillFieldMap() {
|
|
s.fieldMap = make(map[string]field.Expr, 8)
|
|
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["template_id"] = s.TemplateID
|
|
s.fieldMap["joins"] = s.Joins
|
|
s.fieldMap["table"] = s.TblName
|
|
s.fieldMap["on"] = s.On
|
|
}
|
|
|
|
func (s sysExportTemplateJoin) clone(db *gorm.DB) sysExportTemplateJoin {
|
|
s.sysExportTemplateJoinDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return s
|
|
}
|
|
|
|
func (s sysExportTemplateJoin) replaceDB(db *gorm.DB) sysExportTemplateJoin {
|
|
s.sysExportTemplateJoinDo.ReplaceDB(db)
|
|
return s
|
|
}
|
|
|
|
type sysExportTemplateJoinDo struct{ gen.DO }
|
|
|
|
type ISysExportTemplateJoinDo interface {
|
|
gen.SubQuery
|
|
Debug() ISysExportTemplateJoinDo
|
|
WithContext(ctx context.Context) ISysExportTemplateJoinDo
|
|
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
|
ReplaceDB(db *gorm.DB)
|
|
ReadDB() ISysExportTemplateJoinDo
|
|
WriteDB() ISysExportTemplateJoinDo
|
|
As(alias string) gen.Dao
|
|
Session(config *gorm.Session) ISysExportTemplateJoinDo
|
|
Columns(cols ...field.Expr) gen.Columns
|
|
Clauses(conds ...clause.Expression) ISysExportTemplateJoinDo
|
|
Not(conds ...gen.Condition) ISysExportTemplateJoinDo
|
|
Or(conds ...gen.Condition) ISysExportTemplateJoinDo
|
|
Select(conds ...field.Expr) ISysExportTemplateJoinDo
|
|
Where(conds ...gen.Condition) ISysExportTemplateJoinDo
|
|
Order(conds ...field.Expr) ISysExportTemplateJoinDo
|
|
Distinct(cols ...field.Expr) ISysExportTemplateJoinDo
|
|
Omit(cols ...field.Expr) ISysExportTemplateJoinDo
|
|
Join(table schema.Tabler, on ...field.Expr) ISysExportTemplateJoinDo
|
|
LeftJoin(table schema.Tabler, on ...field.Expr) ISysExportTemplateJoinDo
|
|
RightJoin(table schema.Tabler, on ...field.Expr) ISysExportTemplateJoinDo
|
|
Group(cols ...field.Expr) ISysExportTemplateJoinDo
|
|
Having(conds ...gen.Condition) ISysExportTemplateJoinDo
|
|
Limit(limit int) ISysExportTemplateJoinDo
|
|
Offset(offset int) ISysExportTemplateJoinDo
|
|
Count() (count int64, err error)
|
|
Scopes(funcs ...func(gen.Dao) gen.Dao) ISysExportTemplateJoinDo
|
|
Unscoped() ISysExportTemplateJoinDo
|
|
Create(values ...*model.SysExportTemplateJoin) error
|
|
CreateInBatches(values []*model.SysExportTemplateJoin, batchSize int) error
|
|
Save(values ...*model.SysExportTemplateJoin) error
|
|
First() (*model.SysExportTemplateJoin, error)
|
|
Take() (*model.SysExportTemplateJoin, error)
|
|
Last() (*model.SysExportTemplateJoin, error)
|
|
Find() ([]*model.SysExportTemplateJoin, error)
|
|
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SysExportTemplateJoin, err error)
|
|
FindInBatches(result *[]*model.SysExportTemplateJoin, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
|
Pluck(column field.Expr, dest interface{}) error
|
|
Delete(...*model.SysExportTemplateJoin) (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) ISysExportTemplateJoinDo
|
|
Assign(attrs ...field.AssignExpr) ISysExportTemplateJoinDo
|
|
Joins(fields ...field.RelationField) ISysExportTemplateJoinDo
|
|
Preload(fields ...field.RelationField) ISysExportTemplateJoinDo
|
|
FirstOrInit() (*model.SysExportTemplateJoin, error)
|
|
FirstOrCreate() (*model.SysExportTemplateJoin, error)
|
|
FindByPage(offset int, limit int) (result []*model.SysExportTemplateJoin, 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) ISysExportTemplateJoinDo
|
|
UnderlyingDB() *gorm.DB
|
|
schema.Tabler
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Debug() ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Debug())
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) WithContext(ctx context.Context) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) ReadDB() ISysExportTemplateJoinDo {
|
|
return s.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) WriteDB() ISysExportTemplateJoinDo {
|
|
return s.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Session(config *gorm.Session) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Session(config))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Clauses(conds ...clause.Expression) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Returning(value interface{}, columns ...string) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Not(conds ...gen.Condition) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Not(conds...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Or(conds ...gen.Condition) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Or(conds...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Select(conds ...field.Expr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Select(conds...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Where(conds ...gen.Condition) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Where(conds...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Order(conds ...field.Expr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Order(conds...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Distinct(cols ...field.Expr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Omit(cols ...field.Expr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Omit(cols...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Join(table schema.Tabler, on ...field.Expr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Join(table, on...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) LeftJoin(table schema.Tabler, on ...field.Expr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) RightJoin(table schema.Tabler, on ...field.Expr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Group(cols ...field.Expr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Group(cols...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Having(conds ...gen.Condition) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Having(conds...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Limit(limit int) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Limit(limit))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Offset(offset int) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Offset(offset))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Unscoped() ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Unscoped())
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Create(values ...*model.SysExportTemplateJoin) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return s.DO.Create(values)
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) CreateInBatches(values []*model.SysExportTemplateJoin, 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 sysExportTemplateJoinDo) Save(values ...*model.SysExportTemplateJoin) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return s.DO.Save(values)
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) First() (*model.SysExportTemplateJoin, error) {
|
|
if result, err := s.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysExportTemplateJoin), nil
|
|
}
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Take() (*model.SysExportTemplateJoin, error) {
|
|
if result, err := s.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysExportTemplateJoin), nil
|
|
}
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Last() (*model.SysExportTemplateJoin, error) {
|
|
if result, err := s.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysExportTemplateJoin), nil
|
|
}
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Find() ([]*model.SysExportTemplateJoin, error) {
|
|
result, err := s.DO.Find()
|
|
return result.([]*model.SysExportTemplateJoin), err
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SysExportTemplateJoin, err error) {
|
|
buf := make([]*model.SysExportTemplateJoin, 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 sysExportTemplateJoinDo) FindInBatches(result *[]*model.SysExportTemplateJoin, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return s.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Attrs(attrs ...field.AssignExpr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Assign(attrs ...field.AssignExpr) ISysExportTemplateJoinDo {
|
|
return s.withDO(s.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Joins(fields ...field.RelationField) ISysExportTemplateJoinDo {
|
|
for _, _f := range fields {
|
|
s = *s.withDO(s.DO.Joins(_f))
|
|
}
|
|
return &s
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Preload(fields ...field.RelationField) ISysExportTemplateJoinDo {
|
|
for _, _f := range fields {
|
|
s = *s.withDO(s.DO.Preload(_f))
|
|
}
|
|
return &s
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) FirstOrInit() (*model.SysExportTemplateJoin, error) {
|
|
if result, err := s.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysExportTemplateJoin), nil
|
|
}
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) FirstOrCreate() (*model.SysExportTemplateJoin, error) {
|
|
if result, err := s.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SysExportTemplateJoin), nil
|
|
}
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) FindByPage(offset int, limit int) (result []*model.SysExportTemplateJoin, 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 sysExportTemplateJoinDo) 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 sysExportTemplateJoinDo) Scan(result interface{}) (err error) {
|
|
return s.DO.Scan(result)
|
|
}
|
|
|
|
func (s sysExportTemplateJoinDo) Delete(models ...*model.SysExportTemplateJoin) (result gen.ResultInfo, err error) {
|
|
return s.DO.Delete(models)
|
|
}
|
|
|
|
func (s *sysExportTemplateJoinDo) withDO(do gen.Dao) *sysExportTemplateJoinDo {
|
|
s.DO = *do.(*gen.DO)
|
|
return s
|
|
}
|