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