zdravko/internal/models/query/cronjob_histories.gen.go

486 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"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
"code.tjo.space/mentos1386/zdravko/internal/models"
)
func newCronjobHistory(db *gorm.DB, opts ...gen.DOOption) cronjobHistory {
_cronjobHistory := cronjobHistory{}
_cronjobHistory.cronjobHistoryDo.UseDB(db, opts...)
_cronjobHistory.cronjobHistoryDo.UseModel(&models.CronjobHistory{})
tableName := _cronjobHistory.cronjobHistoryDo.TableName()
_cronjobHistory.ALL = field.NewAsterisk(tableName)
_cronjobHistory.ID = field.NewUint(tableName, "id")
_cronjobHistory.CreatedAt = field.NewTime(tableName, "created_at")
_cronjobHistory.UpdatedAt = field.NewTime(tableName, "updated_at")
_cronjobHistory.DeletedAt = field.NewField(tableName, "deleted_at")
_cronjobHistory.Status = field.NewString(tableName, "status")
_cronjobHistory.Cronjob = cronjobHistoryHasOneCronjob{
db: db.Session(&gorm.Session{}),
RelationField: field.NewRelation("Cronjob", "models.Cronjob"),
}
_cronjobHistory.fillFieldMap()
return _cronjobHistory
}
type cronjobHistory struct {
cronjobHistoryDo cronjobHistoryDo
ALL field.Asterisk
ID field.Uint
CreatedAt field.Time
UpdatedAt field.Time
DeletedAt field.Field
Status field.String
Cronjob cronjobHistoryHasOneCronjob
fieldMap map[string]field.Expr
}
func (c cronjobHistory) Table(newTableName string) *cronjobHistory {
c.cronjobHistoryDo.UseTable(newTableName)
return c.updateTableName(newTableName)
}
func (c cronjobHistory) As(alias string) *cronjobHistory {
c.cronjobHistoryDo.DO = *(c.cronjobHistoryDo.As(alias).(*gen.DO))
return c.updateTableName(alias)
}
func (c *cronjobHistory) updateTableName(table string) *cronjobHistory {
c.ALL = field.NewAsterisk(table)
c.ID = field.NewUint(table, "id")
c.CreatedAt = field.NewTime(table, "created_at")
c.UpdatedAt = field.NewTime(table, "updated_at")
c.DeletedAt = field.NewField(table, "deleted_at")
c.Status = field.NewString(table, "status")
c.fillFieldMap()
return c
}
func (c *cronjobHistory) WithContext(ctx context.Context) ICronjobHistoryDo {
return c.cronjobHistoryDo.WithContext(ctx)
}
func (c cronjobHistory) TableName() string { return c.cronjobHistoryDo.TableName() }
func (c cronjobHistory) Alias() string { return c.cronjobHistoryDo.Alias() }
func (c cronjobHistory) Columns(cols ...field.Expr) gen.Columns {
return c.cronjobHistoryDo.Columns(cols...)
}
func (c *cronjobHistory) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := c.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (c *cronjobHistory) fillFieldMap() {
c.fieldMap = make(map[string]field.Expr, 6)
c.fieldMap["id"] = c.ID
c.fieldMap["created_at"] = c.CreatedAt
c.fieldMap["updated_at"] = c.UpdatedAt
c.fieldMap["deleted_at"] = c.DeletedAt
c.fieldMap["status"] = c.Status
}
func (c cronjobHistory) clone(db *gorm.DB) cronjobHistory {
c.cronjobHistoryDo.ReplaceConnPool(db.Statement.ConnPool)
return c
}
func (c cronjobHistory) replaceDB(db *gorm.DB) cronjobHistory {
c.cronjobHistoryDo.ReplaceDB(db)
return c
}
type cronjobHistoryHasOneCronjob struct {
db *gorm.DB
field.RelationField
}
func (a cronjobHistoryHasOneCronjob) Where(conds ...field.Expr) *cronjobHistoryHasOneCronjob {
if len(conds) == 0 {
return &a
}
exprs := make([]clause.Expression, 0, len(conds))
for _, cond := range conds {
exprs = append(exprs, cond.BeCond().(clause.Expression))
}
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
return &a
}
func (a cronjobHistoryHasOneCronjob) WithContext(ctx context.Context) *cronjobHistoryHasOneCronjob {
a.db = a.db.WithContext(ctx)
return &a
}
func (a cronjobHistoryHasOneCronjob) Session(session *gorm.Session) *cronjobHistoryHasOneCronjob {
a.db = a.db.Session(session)
return &a
}
func (a cronjobHistoryHasOneCronjob) Model(m *models.CronjobHistory) *cronjobHistoryHasOneCronjobTx {
return &cronjobHistoryHasOneCronjobTx{a.db.Model(m).Association(a.Name())}
}
type cronjobHistoryHasOneCronjobTx struct{ tx *gorm.Association }
func (a cronjobHistoryHasOneCronjobTx) Find() (result *models.Cronjob, err error) {
return result, a.tx.Find(&result)
}
func (a cronjobHistoryHasOneCronjobTx) Append(values ...*models.Cronjob) (err error) {
targetValues := make([]interface{}, len(values))
for i, v := range values {
targetValues[i] = v
}
return a.tx.Append(targetValues...)
}
func (a cronjobHistoryHasOneCronjobTx) Replace(values ...*models.Cronjob) (err error) {
targetValues := make([]interface{}, len(values))
for i, v := range values {
targetValues[i] = v
}
return a.tx.Replace(targetValues...)
}
func (a cronjobHistoryHasOneCronjobTx) Delete(values ...*models.Cronjob) (err error) {
targetValues := make([]interface{}, len(values))
for i, v := range values {
targetValues[i] = v
}
return a.tx.Delete(targetValues...)
}
func (a cronjobHistoryHasOneCronjobTx) Clear() error {
return a.tx.Clear()
}
func (a cronjobHistoryHasOneCronjobTx) Count() int64 {
return a.tx.Count()
}
type cronjobHistoryDo struct{ gen.DO }
type ICronjobHistoryDo interface {
gen.SubQuery
Debug() ICronjobHistoryDo
WithContext(ctx context.Context) ICronjobHistoryDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() ICronjobHistoryDo
WriteDB() ICronjobHistoryDo
As(alias string) gen.Dao
Session(config *gorm.Session) ICronjobHistoryDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) ICronjobHistoryDo
Not(conds ...gen.Condition) ICronjobHistoryDo
Or(conds ...gen.Condition) ICronjobHistoryDo
Select(conds ...field.Expr) ICronjobHistoryDo
Where(conds ...gen.Condition) ICronjobHistoryDo
Order(conds ...field.Expr) ICronjobHistoryDo
Distinct(cols ...field.Expr) ICronjobHistoryDo
Omit(cols ...field.Expr) ICronjobHistoryDo
Join(table schema.Tabler, on ...field.Expr) ICronjobHistoryDo
LeftJoin(table schema.Tabler, on ...field.Expr) ICronjobHistoryDo
RightJoin(table schema.Tabler, on ...field.Expr) ICronjobHistoryDo
Group(cols ...field.Expr) ICronjobHistoryDo
Having(conds ...gen.Condition) ICronjobHistoryDo
Limit(limit int) ICronjobHistoryDo
Offset(offset int) ICronjobHistoryDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) ICronjobHistoryDo
Unscoped() ICronjobHistoryDo
Create(values ...*models.CronjobHistory) error
CreateInBatches(values []*models.CronjobHistory, batchSize int) error
Save(values ...*models.CronjobHistory) error
First() (*models.CronjobHistory, error)
Take() (*models.CronjobHistory, error)
Last() (*models.CronjobHistory, error)
Find() ([]*models.CronjobHistory, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CronjobHistory, err error)
FindInBatches(result *[]*models.CronjobHistory, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*models.CronjobHistory) (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) ICronjobHistoryDo
Assign(attrs ...field.AssignExpr) ICronjobHistoryDo
Joins(fields ...field.RelationField) ICronjobHistoryDo
Preload(fields ...field.RelationField) ICronjobHistoryDo
FirstOrInit() (*models.CronjobHistory, error)
FirstOrCreate() (*models.CronjobHistory, error)
FindByPage(offset int, limit int) (result []*models.CronjobHistory, 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) ICronjobHistoryDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (c cronjobHistoryDo) Debug() ICronjobHistoryDo {
return c.withDO(c.DO.Debug())
}
func (c cronjobHistoryDo) WithContext(ctx context.Context) ICronjobHistoryDo {
return c.withDO(c.DO.WithContext(ctx))
}
func (c cronjobHistoryDo) ReadDB() ICronjobHistoryDo {
return c.Clauses(dbresolver.Read)
}
func (c cronjobHistoryDo) WriteDB() ICronjobHistoryDo {
return c.Clauses(dbresolver.Write)
}
func (c cronjobHistoryDo) Session(config *gorm.Session) ICronjobHistoryDo {
return c.withDO(c.DO.Session(config))
}
func (c cronjobHistoryDo) Clauses(conds ...clause.Expression) ICronjobHistoryDo {
return c.withDO(c.DO.Clauses(conds...))
}
func (c cronjobHistoryDo) Returning(value interface{}, columns ...string) ICronjobHistoryDo {
return c.withDO(c.DO.Returning(value, columns...))
}
func (c cronjobHistoryDo) Not(conds ...gen.Condition) ICronjobHistoryDo {
return c.withDO(c.DO.Not(conds...))
}
func (c cronjobHistoryDo) Or(conds ...gen.Condition) ICronjobHistoryDo {
return c.withDO(c.DO.Or(conds...))
}
func (c cronjobHistoryDo) Select(conds ...field.Expr) ICronjobHistoryDo {
return c.withDO(c.DO.Select(conds...))
}
func (c cronjobHistoryDo) Where(conds ...gen.Condition) ICronjobHistoryDo {
return c.withDO(c.DO.Where(conds...))
}
func (c cronjobHistoryDo) Order(conds ...field.Expr) ICronjobHistoryDo {
return c.withDO(c.DO.Order(conds...))
}
func (c cronjobHistoryDo) Distinct(cols ...field.Expr) ICronjobHistoryDo {
return c.withDO(c.DO.Distinct(cols...))
}
func (c cronjobHistoryDo) Omit(cols ...field.Expr) ICronjobHistoryDo {
return c.withDO(c.DO.Omit(cols...))
}
func (c cronjobHistoryDo) Join(table schema.Tabler, on ...field.Expr) ICronjobHistoryDo {
return c.withDO(c.DO.Join(table, on...))
}
func (c cronjobHistoryDo) LeftJoin(table schema.Tabler, on ...field.Expr) ICronjobHistoryDo {
return c.withDO(c.DO.LeftJoin(table, on...))
}
func (c cronjobHistoryDo) RightJoin(table schema.Tabler, on ...field.Expr) ICronjobHistoryDo {
return c.withDO(c.DO.RightJoin(table, on...))
}
func (c cronjobHistoryDo) Group(cols ...field.Expr) ICronjobHistoryDo {
return c.withDO(c.DO.Group(cols...))
}
func (c cronjobHistoryDo) Having(conds ...gen.Condition) ICronjobHistoryDo {
return c.withDO(c.DO.Having(conds...))
}
func (c cronjobHistoryDo) Limit(limit int) ICronjobHistoryDo {
return c.withDO(c.DO.Limit(limit))
}
func (c cronjobHistoryDo) Offset(offset int) ICronjobHistoryDo {
return c.withDO(c.DO.Offset(offset))
}
func (c cronjobHistoryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ICronjobHistoryDo {
return c.withDO(c.DO.Scopes(funcs...))
}
func (c cronjobHistoryDo) Unscoped() ICronjobHistoryDo {
return c.withDO(c.DO.Unscoped())
}
func (c cronjobHistoryDo) Create(values ...*models.CronjobHistory) error {
if len(values) == 0 {
return nil
}
return c.DO.Create(values)
}
func (c cronjobHistoryDo) CreateInBatches(values []*models.CronjobHistory, batchSize int) error {
return c.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 (c cronjobHistoryDo) Save(values ...*models.CronjobHistory) error {
if len(values) == 0 {
return nil
}
return c.DO.Save(values)
}
func (c cronjobHistoryDo) First() (*models.CronjobHistory, error) {
if result, err := c.DO.First(); err != nil {
return nil, err
} else {
return result.(*models.CronjobHistory), nil
}
}
func (c cronjobHistoryDo) Take() (*models.CronjobHistory, error) {
if result, err := c.DO.Take(); err != nil {
return nil, err
} else {
return result.(*models.CronjobHistory), nil
}
}
func (c cronjobHistoryDo) Last() (*models.CronjobHistory, error) {
if result, err := c.DO.Last(); err != nil {
return nil, err
} else {
return result.(*models.CronjobHistory), nil
}
}
func (c cronjobHistoryDo) Find() ([]*models.CronjobHistory, error) {
result, err := c.DO.Find()
return result.([]*models.CronjobHistory), err
}
func (c cronjobHistoryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.CronjobHistory, err error) {
buf := make([]*models.CronjobHistory, 0, batchSize)
err = c.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 (c cronjobHistoryDo) FindInBatches(result *[]*models.CronjobHistory, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return c.DO.FindInBatches(result, batchSize, fc)
}
func (c cronjobHistoryDo) Attrs(attrs ...field.AssignExpr) ICronjobHistoryDo {
return c.withDO(c.DO.Attrs(attrs...))
}
func (c cronjobHistoryDo) Assign(attrs ...field.AssignExpr) ICronjobHistoryDo {
return c.withDO(c.DO.Assign(attrs...))
}
func (c cronjobHistoryDo) Joins(fields ...field.RelationField) ICronjobHistoryDo {
for _, _f := range fields {
c = *c.withDO(c.DO.Joins(_f))
}
return &c
}
func (c cronjobHistoryDo) Preload(fields ...field.RelationField) ICronjobHistoryDo {
for _, _f := range fields {
c = *c.withDO(c.DO.Preload(_f))
}
return &c
}
func (c cronjobHistoryDo) FirstOrInit() (*models.CronjobHistory, error) {
if result, err := c.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*models.CronjobHistory), nil
}
}
func (c cronjobHistoryDo) FirstOrCreate() (*models.CronjobHistory, error) {
if result, err := c.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*models.CronjobHistory), nil
}
}
func (c cronjobHistoryDo) FindByPage(offset int, limit int) (result []*models.CronjobHistory, count int64, err error) {
result, err = c.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 = c.Offset(-1).Limit(-1).Count()
return
}
func (c cronjobHistoryDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = c.Count()
if err != nil {
return
}
err = c.Offset(offset).Limit(limit).Scan(result)
return
}
func (c cronjobHistoryDo) Scan(result interface{}) (err error) {
return c.DO.Scan(result)
}
func (c cronjobHistoryDo) Delete(models ...*models.CronjobHistory) (result gen.ResultInfo, err error) {
return c.DO.Delete(models)
}
func (c *cronjobHistoryDo) withDO(do gen.Dao) *cronjobHistoryDo {
c.DO = *do.(*gen.DO)
return c
}