rts-sim-testing-service/db/dbquery/project_train_size.gen.go

389 lines
12 KiB
Go
Raw Normal View History

// 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 dbquery
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
"joylink.club/bj-rtsts-server/db/model"
)
func newProjectTrainSize(db *gorm.DB, opts ...gen.DOOption) projectTrainSize {
_projectTrainSize := projectTrainSize{}
_projectTrainSize.projectTrainSizeDo.UseDB(db, opts...)
_projectTrainSize.projectTrainSizeDo.UseModel(&model.ProjectTrainSize{})
tableName := _projectTrainSize.projectTrainSizeDo.TableName()
_projectTrainSize.ALL = field.NewAsterisk(tableName)
_projectTrainSize.ID = field.NewInt32(tableName, "id")
_projectTrainSize.Pid = field.NewInt32(tableName, "pid")
_projectTrainSize.Sid = field.NewInt32(tableName, "sid")
_projectTrainSize.fillFieldMap()
return _projectTrainSize
}
type projectTrainSize struct {
projectTrainSizeDo
ALL field.Asterisk
ID field.Int32 // 主键
Pid field.Int32 // 项目主键
Sid field.Int32 // 列车尺寸主键
fieldMap map[string]field.Expr
}
func (p projectTrainSize) Table(newTableName string) *projectTrainSize {
p.projectTrainSizeDo.UseTable(newTableName)
return p.updateTableName(newTableName)
}
func (p projectTrainSize) As(alias string) *projectTrainSize {
p.projectTrainSizeDo.DO = *(p.projectTrainSizeDo.As(alias).(*gen.DO))
return p.updateTableName(alias)
}
func (p *projectTrainSize) updateTableName(table string) *projectTrainSize {
p.ALL = field.NewAsterisk(table)
p.ID = field.NewInt32(table, "id")
p.Pid = field.NewInt32(table, "pid")
p.Sid = field.NewInt32(table, "sid")
p.fillFieldMap()
return p
}
func (p *projectTrainSize) 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 *projectTrainSize) fillFieldMap() {
p.fieldMap = make(map[string]field.Expr, 3)
p.fieldMap["id"] = p.ID
p.fieldMap["pid"] = p.Pid
p.fieldMap["sid"] = p.Sid
}
func (p projectTrainSize) clone(db *gorm.DB) projectTrainSize {
p.projectTrainSizeDo.ReplaceConnPool(db.Statement.ConnPool)
return p
}
func (p projectTrainSize) replaceDB(db *gorm.DB) projectTrainSize {
p.projectTrainSizeDo.ReplaceDB(db)
return p
}
type projectTrainSizeDo struct{ gen.DO }
type IProjectTrainSizeDo interface {
gen.SubQuery
Debug() IProjectTrainSizeDo
WithContext(ctx context.Context) IProjectTrainSizeDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IProjectTrainSizeDo
WriteDB() IProjectTrainSizeDo
As(alias string) gen.Dao
Session(config *gorm.Session) IProjectTrainSizeDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IProjectTrainSizeDo
Not(conds ...gen.Condition) IProjectTrainSizeDo
Or(conds ...gen.Condition) IProjectTrainSizeDo
Select(conds ...field.Expr) IProjectTrainSizeDo
Where(conds ...gen.Condition) IProjectTrainSizeDo
Order(conds ...field.Expr) IProjectTrainSizeDo
Distinct(cols ...field.Expr) IProjectTrainSizeDo
Omit(cols ...field.Expr) IProjectTrainSizeDo
Join(table schema.Tabler, on ...field.Expr) IProjectTrainSizeDo
LeftJoin(table schema.Tabler, on ...field.Expr) IProjectTrainSizeDo
RightJoin(table schema.Tabler, on ...field.Expr) IProjectTrainSizeDo
Group(cols ...field.Expr) IProjectTrainSizeDo
Having(conds ...gen.Condition) IProjectTrainSizeDo
Limit(limit int) IProjectTrainSizeDo
Offset(offset int) IProjectTrainSizeDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IProjectTrainSizeDo
Unscoped() IProjectTrainSizeDo
Create(values ...*model.ProjectTrainSize) error
CreateInBatches(values []*model.ProjectTrainSize, batchSize int) error
Save(values ...*model.ProjectTrainSize) error
First() (*model.ProjectTrainSize, error)
Take() (*model.ProjectTrainSize, error)
Last() (*model.ProjectTrainSize, error)
Find() ([]*model.ProjectTrainSize, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ProjectTrainSize, err error)
FindInBatches(result *[]*model.ProjectTrainSize, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ProjectTrainSize) (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) IProjectTrainSizeDo
Assign(attrs ...field.AssignExpr) IProjectTrainSizeDo
Joins(fields ...field.RelationField) IProjectTrainSizeDo
Preload(fields ...field.RelationField) IProjectTrainSizeDo
FirstOrInit() (*model.ProjectTrainSize, error)
FirstOrCreate() (*model.ProjectTrainSize, error)
FindByPage(offset int, limit int) (result []*model.ProjectTrainSize, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IProjectTrainSizeDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (p projectTrainSizeDo) Debug() IProjectTrainSizeDo {
return p.withDO(p.DO.Debug())
}
func (p projectTrainSizeDo) WithContext(ctx context.Context) IProjectTrainSizeDo {
return p.withDO(p.DO.WithContext(ctx))
}
func (p projectTrainSizeDo) ReadDB() IProjectTrainSizeDo {
return p.Clauses(dbresolver.Read)
}
func (p projectTrainSizeDo) WriteDB() IProjectTrainSizeDo {
return p.Clauses(dbresolver.Write)
}
func (p projectTrainSizeDo) Session(config *gorm.Session) IProjectTrainSizeDo {
return p.withDO(p.DO.Session(config))
}
func (p projectTrainSizeDo) Clauses(conds ...clause.Expression) IProjectTrainSizeDo {
return p.withDO(p.DO.Clauses(conds...))
}
func (p projectTrainSizeDo) Returning(value interface{}, columns ...string) IProjectTrainSizeDo {
return p.withDO(p.DO.Returning(value, columns...))
}
func (p projectTrainSizeDo) Not(conds ...gen.Condition) IProjectTrainSizeDo {
return p.withDO(p.DO.Not(conds...))
}
func (p projectTrainSizeDo) Or(conds ...gen.Condition) IProjectTrainSizeDo {
return p.withDO(p.DO.Or(conds...))
}
func (p projectTrainSizeDo) Select(conds ...field.Expr) IProjectTrainSizeDo {
return p.withDO(p.DO.Select(conds...))
}
func (p projectTrainSizeDo) Where(conds ...gen.Condition) IProjectTrainSizeDo {
return p.withDO(p.DO.Where(conds...))
}
func (p projectTrainSizeDo) Order(conds ...field.Expr) IProjectTrainSizeDo {
return p.withDO(p.DO.Order(conds...))
}
func (p projectTrainSizeDo) Distinct(cols ...field.Expr) IProjectTrainSizeDo {
return p.withDO(p.DO.Distinct(cols...))
}
func (p projectTrainSizeDo) Omit(cols ...field.Expr) IProjectTrainSizeDo {
return p.withDO(p.DO.Omit(cols...))
}
func (p projectTrainSizeDo) Join(table schema.Tabler, on ...field.Expr) IProjectTrainSizeDo {
return p.withDO(p.DO.Join(table, on...))
}
func (p projectTrainSizeDo) LeftJoin(table schema.Tabler, on ...field.Expr) IProjectTrainSizeDo {
return p.withDO(p.DO.LeftJoin(table, on...))
}
func (p projectTrainSizeDo) RightJoin(table schema.Tabler, on ...field.Expr) IProjectTrainSizeDo {
return p.withDO(p.DO.RightJoin(table, on...))
}
func (p projectTrainSizeDo) Group(cols ...field.Expr) IProjectTrainSizeDo {
return p.withDO(p.DO.Group(cols...))
}
func (p projectTrainSizeDo) Having(conds ...gen.Condition) IProjectTrainSizeDo {
return p.withDO(p.DO.Having(conds...))
}
func (p projectTrainSizeDo) Limit(limit int) IProjectTrainSizeDo {
return p.withDO(p.DO.Limit(limit))
}
func (p projectTrainSizeDo) Offset(offset int) IProjectTrainSizeDo {
return p.withDO(p.DO.Offset(offset))
}
func (p projectTrainSizeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IProjectTrainSizeDo {
return p.withDO(p.DO.Scopes(funcs...))
}
func (p projectTrainSizeDo) Unscoped() IProjectTrainSizeDo {
return p.withDO(p.DO.Unscoped())
}
func (p projectTrainSizeDo) Create(values ...*model.ProjectTrainSize) error {
if len(values) == 0 {
return nil
}
return p.DO.Create(values)
}
func (p projectTrainSizeDo) CreateInBatches(values []*model.ProjectTrainSize, 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 projectTrainSizeDo) Save(values ...*model.ProjectTrainSize) error {
if len(values) == 0 {
return nil
}
return p.DO.Save(values)
}
func (p projectTrainSizeDo) First() (*model.ProjectTrainSize, error) {
if result, err := p.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ProjectTrainSize), nil
}
}
func (p projectTrainSizeDo) Take() (*model.ProjectTrainSize, error) {
if result, err := p.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ProjectTrainSize), nil
}
}
func (p projectTrainSizeDo) Last() (*model.ProjectTrainSize, error) {
if result, err := p.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ProjectTrainSize), nil
}
}
func (p projectTrainSizeDo) Find() ([]*model.ProjectTrainSize, error) {
result, err := p.DO.Find()
return result.([]*model.ProjectTrainSize), err
}
func (p projectTrainSizeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ProjectTrainSize, err error) {
buf := make([]*model.ProjectTrainSize, 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 projectTrainSizeDo) FindInBatches(result *[]*model.ProjectTrainSize, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return p.DO.FindInBatches(result, batchSize, fc)
}
func (p projectTrainSizeDo) Attrs(attrs ...field.AssignExpr) IProjectTrainSizeDo {
return p.withDO(p.DO.Attrs(attrs...))
}
func (p projectTrainSizeDo) Assign(attrs ...field.AssignExpr) IProjectTrainSizeDo {
return p.withDO(p.DO.Assign(attrs...))
}
func (p projectTrainSizeDo) Joins(fields ...field.RelationField) IProjectTrainSizeDo {
for _, _f := range fields {
p = *p.withDO(p.DO.Joins(_f))
}
return &p
}
func (p projectTrainSizeDo) Preload(fields ...field.RelationField) IProjectTrainSizeDo {
for _, _f := range fields {
p = *p.withDO(p.DO.Preload(_f))
}
return &p
}
func (p projectTrainSizeDo) FirstOrInit() (*model.ProjectTrainSize, error) {
if result, err := p.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ProjectTrainSize), nil
}
}
func (p projectTrainSizeDo) FirstOrCreate() (*model.ProjectTrainSize, error) {
if result, err := p.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ProjectTrainSize), nil
}
}
func (p projectTrainSizeDo) FindByPage(offset int, limit int) (result []*model.ProjectTrainSize, 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 projectTrainSizeDo) 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 projectTrainSizeDo) Scan(result interface{}) (err error) {
return p.DO.Scan(result)
}
func (p projectTrainSizeDo) Delete(models ...*model.ProjectTrainSize) (result gen.ResultInfo, err error) {
return p.DO.Delete(models)
}
func (p *projectTrainSizeDo) withDO(do gen.Dao) *projectTrainSizeDo {
p.DO = *do.(*gen.DO)
return p
}