428 lines
15 KiB
Go
428 lines
15 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 newExaFileUploadAndDownload(db *gorm.DB, opts ...gen.DOOption) exaFileUploadAndDownload {
|
|
_exaFileUploadAndDownload := exaFileUploadAndDownload{}
|
|
|
|
_exaFileUploadAndDownload.exaFileUploadAndDownloadDo.UseDB(db, opts...)
|
|
_exaFileUploadAndDownload.exaFileUploadAndDownloadDo.UseModel(&model.ExaFileUploadAndDownload{})
|
|
|
|
tableName := _exaFileUploadAndDownload.exaFileUploadAndDownloadDo.TableName()
|
|
_exaFileUploadAndDownload.ALL = field.NewAsterisk(tableName)
|
|
_exaFileUploadAndDownload.ID = field.NewInt64(tableName, "id")
|
|
_exaFileUploadAndDownload.CreatedAt = field.NewTime(tableName, "created_at")
|
|
_exaFileUploadAndDownload.UpdatedAt = field.NewTime(tableName, "updated_at")
|
|
_exaFileUploadAndDownload.DeletedAt = field.NewField(tableName, "deleted_at")
|
|
_exaFileUploadAndDownload.Name = field.NewString(tableName, "name")
|
|
_exaFileUploadAndDownload.ClassID = field.NewInt64(tableName, "class_id")
|
|
_exaFileUploadAndDownload.URL = field.NewString(tableName, "url")
|
|
_exaFileUploadAndDownload.Tag = field.NewString(tableName, "tag")
|
|
_exaFileUploadAndDownload.Key = field.NewString(tableName, "key")
|
|
|
|
_exaFileUploadAndDownload.fillFieldMap()
|
|
|
|
return _exaFileUploadAndDownload
|
|
}
|
|
|
|
type exaFileUploadAndDownload struct {
|
|
exaFileUploadAndDownloadDo exaFileUploadAndDownloadDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Int64
|
|
CreatedAt field.Time
|
|
UpdatedAt field.Time
|
|
DeletedAt field.Field
|
|
Name field.String // 文件名
|
|
ClassID field.Int64 // 分类id
|
|
URL field.String // 文件地址
|
|
Tag field.String // 文件标签
|
|
Key field.String // 编号
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (e exaFileUploadAndDownload) Table(newTableName string) *exaFileUploadAndDownload {
|
|
e.exaFileUploadAndDownloadDo.UseTable(newTableName)
|
|
return e.updateTableName(newTableName)
|
|
}
|
|
|
|
func (e exaFileUploadAndDownload) As(alias string) *exaFileUploadAndDownload {
|
|
e.exaFileUploadAndDownloadDo.DO = *(e.exaFileUploadAndDownloadDo.As(alias).(*gen.DO))
|
|
return e.updateTableName(alias)
|
|
}
|
|
|
|
func (e *exaFileUploadAndDownload) updateTableName(table string) *exaFileUploadAndDownload {
|
|
e.ALL = field.NewAsterisk(table)
|
|
e.ID = field.NewInt64(table, "id")
|
|
e.CreatedAt = field.NewTime(table, "created_at")
|
|
e.UpdatedAt = field.NewTime(table, "updated_at")
|
|
e.DeletedAt = field.NewField(table, "deleted_at")
|
|
e.Name = field.NewString(table, "name")
|
|
e.ClassID = field.NewInt64(table, "class_id")
|
|
e.URL = field.NewString(table, "url")
|
|
e.Tag = field.NewString(table, "tag")
|
|
e.Key = field.NewString(table, "key")
|
|
|
|
e.fillFieldMap()
|
|
|
|
return e
|
|
}
|
|
|
|
func (e *exaFileUploadAndDownload) WithContext(ctx context.Context) IExaFileUploadAndDownloadDo {
|
|
return e.exaFileUploadAndDownloadDo.WithContext(ctx)
|
|
}
|
|
|
|
func (e exaFileUploadAndDownload) TableName() string { return e.exaFileUploadAndDownloadDo.TableName() }
|
|
|
|
func (e exaFileUploadAndDownload) Alias() string { return e.exaFileUploadAndDownloadDo.Alias() }
|
|
|
|
func (e exaFileUploadAndDownload) Columns(cols ...field.Expr) gen.Columns {
|
|
return e.exaFileUploadAndDownloadDo.Columns(cols...)
|
|
}
|
|
|
|
func (e *exaFileUploadAndDownload) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|
_f, ok := e.fieldMap[fieldName]
|
|
if !ok || _f == nil {
|
|
return nil, false
|
|
}
|
|
_oe, ok := _f.(field.OrderExpr)
|
|
return _oe, ok
|
|
}
|
|
|
|
func (e *exaFileUploadAndDownload) fillFieldMap() {
|
|
e.fieldMap = make(map[string]field.Expr, 9)
|
|
e.fieldMap["id"] = e.ID
|
|
e.fieldMap["created_at"] = e.CreatedAt
|
|
e.fieldMap["updated_at"] = e.UpdatedAt
|
|
e.fieldMap["deleted_at"] = e.DeletedAt
|
|
e.fieldMap["name"] = e.Name
|
|
e.fieldMap["class_id"] = e.ClassID
|
|
e.fieldMap["url"] = e.URL
|
|
e.fieldMap["tag"] = e.Tag
|
|
e.fieldMap["key"] = e.Key
|
|
}
|
|
|
|
func (e exaFileUploadAndDownload) clone(db *gorm.DB) exaFileUploadAndDownload {
|
|
e.exaFileUploadAndDownloadDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return e
|
|
}
|
|
|
|
func (e exaFileUploadAndDownload) replaceDB(db *gorm.DB) exaFileUploadAndDownload {
|
|
e.exaFileUploadAndDownloadDo.ReplaceDB(db)
|
|
return e
|
|
}
|
|
|
|
type exaFileUploadAndDownloadDo struct{ gen.DO }
|
|
|
|
type IExaFileUploadAndDownloadDo interface {
|
|
gen.SubQuery
|
|
Debug() IExaFileUploadAndDownloadDo
|
|
WithContext(ctx context.Context) IExaFileUploadAndDownloadDo
|
|
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
|
ReplaceDB(db *gorm.DB)
|
|
ReadDB() IExaFileUploadAndDownloadDo
|
|
WriteDB() IExaFileUploadAndDownloadDo
|
|
As(alias string) gen.Dao
|
|
Session(config *gorm.Session) IExaFileUploadAndDownloadDo
|
|
Columns(cols ...field.Expr) gen.Columns
|
|
Clauses(conds ...clause.Expression) IExaFileUploadAndDownloadDo
|
|
Not(conds ...gen.Condition) IExaFileUploadAndDownloadDo
|
|
Or(conds ...gen.Condition) IExaFileUploadAndDownloadDo
|
|
Select(conds ...field.Expr) IExaFileUploadAndDownloadDo
|
|
Where(conds ...gen.Condition) IExaFileUploadAndDownloadDo
|
|
Order(conds ...field.Expr) IExaFileUploadAndDownloadDo
|
|
Distinct(cols ...field.Expr) IExaFileUploadAndDownloadDo
|
|
Omit(cols ...field.Expr) IExaFileUploadAndDownloadDo
|
|
Join(table schema.Tabler, on ...field.Expr) IExaFileUploadAndDownloadDo
|
|
LeftJoin(table schema.Tabler, on ...field.Expr) IExaFileUploadAndDownloadDo
|
|
RightJoin(table schema.Tabler, on ...field.Expr) IExaFileUploadAndDownloadDo
|
|
Group(cols ...field.Expr) IExaFileUploadAndDownloadDo
|
|
Having(conds ...gen.Condition) IExaFileUploadAndDownloadDo
|
|
Limit(limit int) IExaFileUploadAndDownloadDo
|
|
Offset(offset int) IExaFileUploadAndDownloadDo
|
|
Count() (count int64, err error)
|
|
Scopes(funcs ...func(gen.Dao) gen.Dao) IExaFileUploadAndDownloadDo
|
|
Unscoped() IExaFileUploadAndDownloadDo
|
|
Create(values ...*model.ExaFileUploadAndDownload) error
|
|
CreateInBatches(values []*model.ExaFileUploadAndDownload, batchSize int) error
|
|
Save(values ...*model.ExaFileUploadAndDownload) error
|
|
First() (*model.ExaFileUploadAndDownload, error)
|
|
Take() (*model.ExaFileUploadAndDownload, error)
|
|
Last() (*model.ExaFileUploadAndDownload, error)
|
|
Find() ([]*model.ExaFileUploadAndDownload, error)
|
|
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ExaFileUploadAndDownload, err error)
|
|
FindInBatches(result *[]*model.ExaFileUploadAndDownload, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
|
Pluck(column field.Expr, dest interface{}) error
|
|
Delete(...*model.ExaFileUploadAndDownload) (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) IExaFileUploadAndDownloadDo
|
|
Assign(attrs ...field.AssignExpr) IExaFileUploadAndDownloadDo
|
|
Joins(fields ...field.RelationField) IExaFileUploadAndDownloadDo
|
|
Preload(fields ...field.RelationField) IExaFileUploadAndDownloadDo
|
|
FirstOrInit() (*model.ExaFileUploadAndDownload, error)
|
|
FirstOrCreate() (*model.ExaFileUploadAndDownload, error)
|
|
FindByPage(offset int, limit int) (result []*model.ExaFileUploadAndDownload, 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) IExaFileUploadAndDownloadDo
|
|
UnderlyingDB() *gorm.DB
|
|
schema.Tabler
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Debug() IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Debug())
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) WithContext(ctx context.Context) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) ReadDB() IExaFileUploadAndDownloadDo {
|
|
return e.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) WriteDB() IExaFileUploadAndDownloadDo {
|
|
return e.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Session(config *gorm.Session) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Session(config))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Clauses(conds ...clause.Expression) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Returning(value interface{}, columns ...string) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Not(conds ...gen.Condition) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Not(conds...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Or(conds ...gen.Condition) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Or(conds...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Select(conds ...field.Expr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Select(conds...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Where(conds ...gen.Condition) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Where(conds...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Order(conds ...field.Expr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Order(conds...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Distinct(cols ...field.Expr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Omit(cols ...field.Expr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Omit(cols...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Join(table schema.Tabler, on ...field.Expr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Join(table, on...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) LeftJoin(table schema.Tabler, on ...field.Expr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) RightJoin(table schema.Tabler, on ...field.Expr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Group(cols ...field.Expr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Group(cols...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Having(conds ...gen.Condition) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Having(conds...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Limit(limit int) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Limit(limit))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Offset(offset int) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Offset(offset))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Unscoped() IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Unscoped())
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Create(values ...*model.ExaFileUploadAndDownload) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return e.DO.Create(values)
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) CreateInBatches(values []*model.ExaFileUploadAndDownload, batchSize int) error {
|
|
return e.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 (e exaFileUploadAndDownloadDo) Save(values ...*model.ExaFileUploadAndDownload) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return e.DO.Save(values)
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) First() (*model.ExaFileUploadAndDownload, error) {
|
|
if result, err := e.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ExaFileUploadAndDownload), nil
|
|
}
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Take() (*model.ExaFileUploadAndDownload, error) {
|
|
if result, err := e.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ExaFileUploadAndDownload), nil
|
|
}
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Last() (*model.ExaFileUploadAndDownload, error) {
|
|
if result, err := e.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ExaFileUploadAndDownload), nil
|
|
}
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Find() ([]*model.ExaFileUploadAndDownload, error) {
|
|
result, err := e.DO.Find()
|
|
return result.([]*model.ExaFileUploadAndDownload), err
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ExaFileUploadAndDownload, err error) {
|
|
buf := make([]*model.ExaFileUploadAndDownload, 0, batchSize)
|
|
err = e.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 (e exaFileUploadAndDownloadDo) FindInBatches(result *[]*model.ExaFileUploadAndDownload, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return e.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Attrs(attrs ...field.AssignExpr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Assign(attrs ...field.AssignExpr) IExaFileUploadAndDownloadDo {
|
|
return e.withDO(e.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Joins(fields ...field.RelationField) IExaFileUploadAndDownloadDo {
|
|
for _, _f := range fields {
|
|
e = *e.withDO(e.DO.Joins(_f))
|
|
}
|
|
return &e
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Preload(fields ...field.RelationField) IExaFileUploadAndDownloadDo {
|
|
for _, _f := range fields {
|
|
e = *e.withDO(e.DO.Preload(_f))
|
|
}
|
|
return &e
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) FirstOrInit() (*model.ExaFileUploadAndDownload, error) {
|
|
if result, err := e.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ExaFileUploadAndDownload), nil
|
|
}
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) FirstOrCreate() (*model.ExaFileUploadAndDownload, error) {
|
|
if result, err := e.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ExaFileUploadAndDownload), nil
|
|
}
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) FindByPage(offset int, limit int) (result []*model.ExaFileUploadAndDownload, count int64, err error) {
|
|
result, err = e.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 = e.Offset(-1).Limit(-1).Count()
|
|
return
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
|
count, err = e.Count()
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
err = e.Offset(offset).Limit(limit).Scan(result)
|
|
return
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Scan(result interface{}) (err error) {
|
|
return e.DO.Scan(result)
|
|
}
|
|
|
|
func (e exaFileUploadAndDownloadDo) Delete(models ...*model.ExaFileUploadAndDownload) (result gen.ResultInfo, err error) {
|
|
return e.DO.Delete(models)
|
|
}
|
|
|
|
func (e *exaFileUploadAndDownloadDo) withDO(do gen.Dao) *exaFileUploadAndDownloadDo {
|
|
e.DO = *do.(*gen.DO)
|
|
return e
|
|
}
|