mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-08 17:30:57 +08:00
add gen
This commit is contained in:
398
internal/app/repository/query/process_log.gen.go
Normal file
398
internal/app/repository/query/process_log.gen.go
Normal file
@@ -0,0 +1,398 @@
|
||||
// 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"
|
||||
|
||||
"github.com/lzh-1625/go_process_manager/internal/app/model"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
func newProcessLog(db *gorm.DB, opts ...gen.DOOption) processLog {
|
||||
_processLog := processLog{}
|
||||
|
||||
_processLog.processLogDo.UseDB(db, opts...)
|
||||
_processLog.processLogDo.UseModel(&model.ProcessLog{})
|
||||
|
||||
tableName := _processLog.processLogDo.TableName()
|
||||
_processLog.ALL = field.NewAsterisk(tableName)
|
||||
_processLog.Id = field.NewInt(tableName, "id")
|
||||
_processLog.Log = field.NewString(tableName, "log")
|
||||
_processLog.Time = field.NewInt64(tableName, "time")
|
||||
_processLog.Name = field.NewString(tableName, "name")
|
||||
_processLog.Using = field.NewString(tableName, "using")
|
||||
|
||||
_processLog.fillFieldMap()
|
||||
|
||||
return _processLog
|
||||
}
|
||||
|
||||
type processLog struct {
|
||||
processLogDo
|
||||
|
||||
ALL field.Asterisk
|
||||
Id field.Int
|
||||
Log field.String
|
||||
Time field.Int64
|
||||
Name field.String
|
||||
Using field.String
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (p processLog) Table(newTableName string) *processLog {
|
||||
p.processLogDo.UseTable(newTableName)
|
||||
return p.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (p processLog) As(alias string) *processLog {
|
||||
p.processLogDo.DO = *(p.processLogDo.As(alias).(*gen.DO))
|
||||
return p.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (p *processLog) updateTableName(table string) *processLog {
|
||||
p.ALL = field.NewAsterisk(table)
|
||||
p.Id = field.NewInt(table, "id")
|
||||
p.Log = field.NewString(table, "log")
|
||||
p.Time = field.NewInt64(table, "time")
|
||||
p.Name = field.NewString(table, "name")
|
||||
p.Using = field.NewString(table, "using")
|
||||
|
||||
p.fillFieldMap()
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (p *processLog) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := p.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (p *processLog) fillFieldMap() {
|
||||
p.fieldMap = make(map[string]field.Expr, 5)
|
||||
p.fieldMap["id"] = p.Id
|
||||
p.fieldMap["log"] = p.Log
|
||||
p.fieldMap["time"] = p.Time
|
||||
p.fieldMap["name"] = p.Name
|
||||
p.fieldMap["using"] = p.Using
|
||||
}
|
||||
|
||||
func (p processLog) clone(db *gorm.DB) processLog {
|
||||
p.processLogDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return p
|
||||
}
|
||||
|
||||
func (p processLog) replaceDB(db *gorm.DB) processLog {
|
||||
p.processLogDo.ReplaceDB(db)
|
||||
return p
|
||||
}
|
||||
|
||||
type processLogDo struct{ gen.DO }
|
||||
|
||||
type IProcessLogDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IProcessLogDo
|
||||
WithContext(ctx context.Context) IProcessLogDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IProcessLogDo
|
||||
WriteDB() IProcessLogDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IProcessLogDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IProcessLogDo
|
||||
Not(conds ...gen.Condition) IProcessLogDo
|
||||
Or(conds ...gen.Condition) IProcessLogDo
|
||||
Select(conds ...field.Expr) IProcessLogDo
|
||||
Where(conds ...gen.Condition) IProcessLogDo
|
||||
Order(conds ...field.Expr) IProcessLogDo
|
||||
Distinct(cols ...field.Expr) IProcessLogDo
|
||||
Omit(cols ...field.Expr) IProcessLogDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IProcessLogDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IProcessLogDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IProcessLogDo
|
||||
Group(cols ...field.Expr) IProcessLogDo
|
||||
Having(conds ...gen.Condition) IProcessLogDo
|
||||
Limit(limit int) IProcessLogDo
|
||||
Offset(offset int) IProcessLogDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IProcessLogDo
|
||||
Unscoped() IProcessLogDo
|
||||
Create(values ...*model.ProcessLog) error
|
||||
CreateInBatches(values []*model.ProcessLog, batchSize int) error
|
||||
Save(values ...*model.ProcessLog) error
|
||||
First() (*model.ProcessLog, error)
|
||||
Take() (*model.ProcessLog, error)
|
||||
Last() (*model.ProcessLog, error)
|
||||
Find() ([]*model.ProcessLog, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ProcessLog, err error)
|
||||
FindInBatches(result *[]*model.ProcessLog, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ProcessLog) (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) IProcessLogDo
|
||||
Assign(attrs ...field.AssignExpr) IProcessLogDo
|
||||
Joins(fields ...field.RelationField) IProcessLogDo
|
||||
Preload(fields ...field.RelationField) IProcessLogDo
|
||||
FirstOrInit() (*model.ProcessLog, error)
|
||||
FirstOrCreate() (*model.ProcessLog, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ProcessLog, 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) IProcessLogDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (p processLogDo) Debug() IProcessLogDo {
|
||||
return p.withDO(p.DO.Debug())
|
||||
}
|
||||
|
||||
func (p processLogDo) WithContext(ctx context.Context) IProcessLogDo {
|
||||
return p.withDO(p.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (p processLogDo) ReadDB() IProcessLogDo {
|
||||
return p.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (p processLogDo) WriteDB() IProcessLogDo {
|
||||
return p.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (p processLogDo) Session(config *gorm.Session) IProcessLogDo {
|
||||
return p.withDO(p.DO.Session(config))
|
||||
}
|
||||
|
||||
func (p processLogDo) Clauses(conds ...clause.Expression) IProcessLogDo {
|
||||
return p.withDO(p.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Returning(value interface{}, columns ...string) IProcessLogDo {
|
||||
return p.withDO(p.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Not(conds ...gen.Condition) IProcessLogDo {
|
||||
return p.withDO(p.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Or(conds ...gen.Condition) IProcessLogDo {
|
||||
return p.withDO(p.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Select(conds ...field.Expr) IProcessLogDo {
|
||||
return p.withDO(p.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Where(conds ...gen.Condition) IProcessLogDo {
|
||||
return p.withDO(p.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Order(conds ...field.Expr) IProcessLogDo {
|
||||
return p.withDO(p.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Distinct(cols ...field.Expr) IProcessLogDo {
|
||||
return p.withDO(p.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Omit(cols ...field.Expr) IProcessLogDo {
|
||||
return p.withDO(p.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Join(table schema.Tabler, on ...field.Expr) IProcessLogDo {
|
||||
return p.withDO(p.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (p processLogDo) LeftJoin(table schema.Tabler, on ...field.Expr) IProcessLogDo {
|
||||
return p.withDO(p.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (p processLogDo) RightJoin(table schema.Tabler, on ...field.Expr) IProcessLogDo {
|
||||
return p.withDO(p.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Group(cols ...field.Expr) IProcessLogDo {
|
||||
return p.withDO(p.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Having(conds ...gen.Condition) IProcessLogDo {
|
||||
return p.withDO(p.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Limit(limit int) IProcessLogDo {
|
||||
return p.withDO(p.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (p processLogDo) Offset(offset int) IProcessLogDo {
|
||||
return p.withDO(p.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (p processLogDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IProcessLogDo {
|
||||
return p.withDO(p.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Unscoped() IProcessLogDo {
|
||||
return p.withDO(p.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (p processLogDo) Create(values ...*model.ProcessLog) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return p.DO.Create(values)
|
||||
}
|
||||
|
||||
func (p processLogDo) CreateInBatches(values []*model.ProcessLog, batchSize int) error {
|
||||
return p.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 (p processLogDo) Save(values ...*model.ProcessLog) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return p.DO.Save(values)
|
||||
}
|
||||
|
||||
func (p processLogDo) First() (*model.ProcessLog, error) {
|
||||
if result, err := p.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProcessLog), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p processLogDo) Take() (*model.ProcessLog, error) {
|
||||
if result, err := p.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProcessLog), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p processLogDo) Last() (*model.ProcessLog, error) {
|
||||
if result, err := p.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProcessLog), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p processLogDo) Find() ([]*model.ProcessLog, error) {
|
||||
result, err := p.DO.Find()
|
||||
return result.([]*model.ProcessLog), err
|
||||
}
|
||||
|
||||
func (p processLogDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ProcessLog, err error) {
|
||||
buf := make([]*model.ProcessLog, 0, batchSize)
|
||||
err = p.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 (p processLogDo) FindInBatches(result *[]*model.ProcessLog, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return p.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (p processLogDo) Attrs(attrs ...field.AssignExpr) IProcessLogDo {
|
||||
return p.withDO(p.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Assign(attrs ...field.AssignExpr) IProcessLogDo {
|
||||
return p.withDO(p.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (p processLogDo) Joins(fields ...field.RelationField) IProcessLogDo {
|
||||
for _, _f := range fields {
|
||||
p = *p.withDO(p.DO.Joins(_f))
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
||||
func (p processLogDo) Preload(fields ...field.RelationField) IProcessLogDo {
|
||||
for _, _f := range fields {
|
||||
p = *p.withDO(p.DO.Preload(_f))
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
||||
func (p processLogDo) FirstOrInit() (*model.ProcessLog, error) {
|
||||
if result, err := p.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProcessLog), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p processLogDo) FirstOrCreate() (*model.ProcessLog, error) {
|
||||
if result, err := p.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProcessLog), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p processLogDo) FindByPage(offset int, limit int) (result []*model.ProcessLog, count int64, err error) {
|
||||
result, err = p.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 = p.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (p processLogDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = p.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = p.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (p processLogDo) Scan(result interface{}) (err error) {
|
||||
return p.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (p processLogDo) Delete(models ...*model.ProcessLog) (result gen.ResultInfo, err error) {
|
||||
return p.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (p *processLogDo) withDO(do gen.Dao) *processLogDo {
|
||||
p.DO = *do.(*gen.DO)
|
||||
return p
|
||||
}
|
Reference in New Issue
Block a user