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

401 lines
13 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 newProjectRunConfig(db *gorm.DB, opts ...gen.DOOption) projectRunConfig {
_projectRunConfig := projectRunConfig{}
_projectRunConfig.projectRunConfigDo.UseDB(db, opts...)
_projectRunConfig.projectRunConfigDo.UseModel(&model.ProjectRunConfig{})
tableName := _projectRunConfig.projectRunConfigDo.TableName()
_projectRunConfig.ALL = field.NewAsterisk(tableName)
_projectRunConfig.ID = field.NewInt32(tableName, "id")
_projectRunConfig.Name = field.NewString(tableName, "name")
_projectRunConfig.Description = field.NewString(tableName, "description")
_projectRunConfig.ConfigContent = field.NewString(tableName, "config_content")
_projectRunConfig.CreateTime = field.NewTime(tableName, "create_time")
_projectRunConfig.UpdateTime = field.NewTime(tableName, "update_time")
_projectRunConfig.fillFieldMap()
return _projectRunConfig
}
type projectRunConfig struct {
projectRunConfigDo
ALL field.Asterisk
ID field.Int32
Name field.String // 测试环境名称
Description field.String // 环境描述
ConfigContent field.String // 环境配置信息
CreateTime field.Time // 创建时间
UpdateTime field.Time // 更新时间
fieldMap map[string]field.Expr
}
func (p projectRunConfig) Table(newTableName string) *projectRunConfig {
p.projectRunConfigDo.UseTable(newTableName)
return p.updateTableName(newTableName)
}
func (p projectRunConfig) As(alias string) *projectRunConfig {
p.projectRunConfigDo.DO = *(p.projectRunConfigDo.As(alias).(*gen.DO))
return p.updateTableName(alias)
}
func (p *projectRunConfig) updateTableName(table string) *projectRunConfig {
p.ALL = field.NewAsterisk(table)
p.ID = field.NewInt32(table, "id")
p.Name = field.NewString(table, "name")
p.Description = field.NewString(table, "description")
p.ConfigContent = field.NewString(table, "config_content")
p.CreateTime = field.NewTime(table, "create_time")
p.UpdateTime = field.NewTime(table, "update_time")
p.fillFieldMap()
return p
}
func (p *projectRunConfig) 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 *projectRunConfig) fillFieldMap() {
p.fieldMap = make(map[string]field.Expr, 6)
p.fieldMap["id"] = p.ID
p.fieldMap["name"] = p.Name
p.fieldMap["description"] = p.Description
p.fieldMap["config_content"] = p.ConfigContent
p.fieldMap["create_time"] = p.CreateTime
p.fieldMap["update_time"] = p.UpdateTime
}
func (p projectRunConfig) clone(db *gorm.DB) projectRunConfig {
p.projectRunConfigDo.ReplaceConnPool(db.Statement.ConnPool)
return p
}
func (p projectRunConfig) replaceDB(db *gorm.DB) projectRunConfig {
p.projectRunConfigDo.ReplaceDB(db)
return p
}
type projectRunConfigDo struct{ gen.DO }
type IProjectRunConfigDo interface {
gen.SubQuery
Debug() IProjectRunConfigDo
WithContext(ctx context.Context) IProjectRunConfigDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IProjectRunConfigDo
WriteDB() IProjectRunConfigDo
As(alias string) gen.Dao
Session(config *gorm.Session) IProjectRunConfigDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IProjectRunConfigDo
Not(conds ...gen.Condition) IProjectRunConfigDo
Or(conds ...gen.Condition) IProjectRunConfigDo
Select(conds ...field.Expr) IProjectRunConfigDo
Where(conds ...gen.Condition) IProjectRunConfigDo
Order(conds ...field.Expr) IProjectRunConfigDo
Distinct(cols ...field.Expr) IProjectRunConfigDo
Omit(cols ...field.Expr) IProjectRunConfigDo
Join(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo
LeftJoin(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo
RightJoin(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo
Group(cols ...field.Expr) IProjectRunConfigDo
Having(conds ...gen.Condition) IProjectRunConfigDo
Limit(limit int) IProjectRunConfigDo
Offset(offset int) IProjectRunConfigDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IProjectRunConfigDo
Unscoped() IProjectRunConfigDo
Create(values ...*model.ProjectRunConfig) error
CreateInBatches(values []*model.ProjectRunConfig, batchSize int) error
Save(values ...*model.ProjectRunConfig) error
First() (*model.ProjectRunConfig, error)
Take() (*model.ProjectRunConfig, error)
Last() (*model.ProjectRunConfig, error)
Find() ([]*model.ProjectRunConfig, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ProjectRunConfig, err error)
FindInBatches(result *[]*model.ProjectRunConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ProjectRunConfig) (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) IProjectRunConfigDo
Assign(attrs ...field.AssignExpr) IProjectRunConfigDo
Joins(fields ...field.RelationField) IProjectRunConfigDo
Preload(fields ...field.RelationField) IProjectRunConfigDo
FirstOrInit() (*model.ProjectRunConfig, error)
FirstOrCreate() (*model.ProjectRunConfig, error)
FindByPage(offset int, limit int) (result []*model.ProjectRunConfig, 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) IProjectRunConfigDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (p projectRunConfigDo) Debug() IProjectRunConfigDo {
return p.withDO(p.DO.Debug())
}
func (p projectRunConfigDo) WithContext(ctx context.Context) IProjectRunConfigDo {
return p.withDO(p.DO.WithContext(ctx))
}
func (p projectRunConfigDo) ReadDB() IProjectRunConfigDo {
return p.Clauses(dbresolver.Read)
}
func (p projectRunConfigDo) WriteDB() IProjectRunConfigDo {
return p.Clauses(dbresolver.Write)
}
func (p projectRunConfigDo) Session(config *gorm.Session) IProjectRunConfigDo {
return p.withDO(p.DO.Session(config))
}
func (p projectRunConfigDo) Clauses(conds ...clause.Expression) IProjectRunConfigDo {
return p.withDO(p.DO.Clauses(conds...))
}
func (p projectRunConfigDo) Returning(value interface{}, columns ...string) IProjectRunConfigDo {
return p.withDO(p.DO.Returning(value, columns...))
}
func (p projectRunConfigDo) Not(conds ...gen.Condition) IProjectRunConfigDo {
return p.withDO(p.DO.Not(conds...))
}
func (p projectRunConfigDo) Or(conds ...gen.Condition) IProjectRunConfigDo {
return p.withDO(p.DO.Or(conds...))
}
func (p projectRunConfigDo) Select(conds ...field.Expr) IProjectRunConfigDo {
return p.withDO(p.DO.Select(conds...))
}
func (p projectRunConfigDo) Where(conds ...gen.Condition) IProjectRunConfigDo {
return p.withDO(p.DO.Where(conds...))
}
func (p projectRunConfigDo) Order(conds ...field.Expr) IProjectRunConfigDo {
return p.withDO(p.DO.Order(conds...))
}
func (p projectRunConfigDo) Distinct(cols ...field.Expr) IProjectRunConfigDo {
return p.withDO(p.DO.Distinct(cols...))
}
func (p projectRunConfigDo) Omit(cols ...field.Expr) IProjectRunConfigDo {
return p.withDO(p.DO.Omit(cols...))
}
func (p projectRunConfigDo) Join(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo {
return p.withDO(p.DO.Join(table, on...))
}
func (p projectRunConfigDo) LeftJoin(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo {
return p.withDO(p.DO.LeftJoin(table, on...))
}
func (p projectRunConfigDo) RightJoin(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo {
return p.withDO(p.DO.RightJoin(table, on...))
}
func (p projectRunConfigDo) Group(cols ...field.Expr) IProjectRunConfigDo {
return p.withDO(p.DO.Group(cols...))
}
func (p projectRunConfigDo) Having(conds ...gen.Condition) IProjectRunConfigDo {
return p.withDO(p.DO.Having(conds...))
}
func (p projectRunConfigDo) Limit(limit int) IProjectRunConfigDo {
return p.withDO(p.DO.Limit(limit))
}
func (p projectRunConfigDo) Offset(offset int) IProjectRunConfigDo {
return p.withDO(p.DO.Offset(offset))
}
func (p projectRunConfigDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IProjectRunConfigDo {
return p.withDO(p.DO.Scopes(funcs...))
}
func (p projectRunConfigDo) Unscoped() IProjectRunConfigDo {
return p.withDO(p.DO.Unscoped())
}
func (p projectRunConfigDo) Create(values ...*model.ProjectRunConfig) error {
if len(values) == 0 {
return nil
}
return p.DO.Create(values)
}
func (p projectRunConfigDo) CreateInBatches(values []*model.ProjectRunConfig, 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 projectRunConfigDo) Save(values ...*model.ProjectRunConfig) error {
if len(values) == 0 {
return nil
}
return p.DO.Save(values)
}
func (p projectRunConfigDo) First() (*model.ProjectRunConfig, error) {
if result, err := p.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ProjectRunConfig), nil
}
}
func (p projectRunConfigDo) Take() (*model.ProjectRunConfig, error) {
if result, err := p.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ProjectRunConfig), nil
}
}
func (p projectRunConfigDo) Last() (*model.ProjectRunConfig, error) {
if result, err := p.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ProjectRunConfig), nil
}
}
func (p projectRunConfigDo) Find() ([]*model.ProjectRunConfig, error) {
result, err := p.DO.Find()
return result.([]*model.ProjectRunConfig), err
}
func (p projectRunConfigDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ProjectRunConfig, err error) {
buf := make([]*model.ProjectRunConfig, 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 projectRunConfigDo) FindInBatches(result *[]*model.ProjectRunConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return p.DO.FindInBatches(result, batchSize, fc)
}
func (p projectRunConfigDo) Attrs(attrs ...field.AssignExpr) IProjectRunConfigDo {
return p.withDO(p.DO.Attrs(attrs...))
}
func (p projectRunConfigDo) Assign(attrs ...field.AssignExpr) IProjectRunConfigDo {
return p.withDO(p.DO.Assign(attrs...))
}
func (p projectRunConfigDo) Joins(fields ...field.RelationField) IProjectRunConfigDo {
for _, _f := range fields {
p = *p.withDO(p.DO.Joins(_f))
}
return &p
}
func (p projectRunConfigDo) Preload(fields ...field.RelationField) IProjectRunConfigDo {
for _, _f := range fields {
p = *p.withDO(p.DO.Preload(_f))
}
return &p
}
func (p projectRunConfigDo) FirstOrInit() (*model.ProjectRunConfig, error) {
if result, err := p.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ProjectRunConfig), nil
}
}
func (p projectRunConfigDo) FirstOrCreate() (*model.ProjectRunConfig, error) {
if result, err := p.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ProjectRunConfig), nil
}
}
func (p projectRunConfigDo) FindByPage(offset int, limit int) (result []*model.ProjectRunConfig, 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 projectRunConfigDo) 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 projectRunConfigDo) Scan(result interface{}) (err error) {
return p.DO.Scan(result)
}
func (p projectRunConfigDo) Delete(models ...*model.ProjectRunConfig) (result gen.ResultInfo, err error) {
return p.DO.Delete(models)
}
func (p *projectRunConfigDo) withDO(do gen.Dao) *projectRunConfigDo {
p.DO = *do.(*gen.DO)
return p
}