// 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 newHealthcheckHttp(db *gorm.DB, opts ...gen.DOOption) healthcheckHttp { _healthcheckHttp := healthcheckHttp{} _healthcheckHttp.healthcheckHttpDo.UseDB(db, opts...) _healthcheckHttp.healthcheckHttpDo.UseModel(&models.HealthcheckHttp{}) tableName := _healthcheckHttp.healthcheckHttpDo.TableName() _healthcheckHttp.ALL = field.NewAsterisk(tableName) _healthcheckHttp.ID = field.NewUint(tableName, "id") _healthcheckHttp.CreatedAt = field.NewTime(tableName, "created_at") _healthcheckHttp.UpdatedAt = field.NewTime(tableName, "updated_at") _healthcheckHttp.DeletedAt = field.NewField(tableName, "deleted_at") _healthcheckHttp.Name = field.NewString(tableName, "name") _healthcheckHttp.Status = field.NewString(tableName, "status") _healthcheckHttp.UptimePercentage = field.NewFloat64(tableName, "uptime_percentage") _healthcheckHttp.Schedule = field.NewString(tableName, "schedule") _healthcheckHttp.URL = field.NewString(tableName, "url") _healthcheckHttp.Method = field.NewString(tableName, "method") _healthcheckHttp.fillFieldMap() return _healthcheckHttp } type healthcheckHttp struct { healthcheckHttpDo healthcheckHttpDo ALL field.Asterisk ID field.Uint CreatedAt field.Time UpdatedAt field.Time DeletedAt field.Field Name field.String Status field.String UptimePercentage field.Float64 Schedule field.String URL field.String Method field.String fieldMap map[string]field.Expr } func (h healthcheckHttp) Table(newTableName string) *healthcheckHttp { h.healthcheckHttpDo.UseTable(newTableName) return h.updateTableName(newTableName) } func (h healthcheckHttp) As(alias string) *healthcheckHttp { h.healthcheckHttpDo.DO = *(h.healthcheckHttpDo.As(alias).(*gen.DO)) return h.updateTableName(alias) } func (h *healthcheckHttp) updateTableName(table string) *healthcheckHttp { 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.Name = field.NewString(table, "name") h.Status = field.NewString(table, "status") h.UptimePercentage = field.NewFloat64(table, "uptime_percentage") h.Schedule = field.NewString(table, "schedule") h.URL = field.NewString(table, "url") h.Method = field.NewString(table, "method") h.fillFieldMap() return h } func (h *healthcheckHttp) WithContext(ctx context.Context) IHealthcheckHttpDo { return h.healthcheckHttpDo.WithContext(ctx) } func (h healthcheckHttp) TableName() string { return h.healthcheckHttpDo.TableName() } func (h healthcheckHttp) Alias() string { return h.healthcheckHttpDo.Alias() } func (h healthcheckHttp) Columns(cols ...field.Expr) gen.Columns { return h.healthcheckHttpDo.Columns(cols...) } func (h *healthcheckHttp) 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 *healthcheckHttp) fillFieldMap() { h.fieldMap = make(map[string]field.Expr, 10) 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["name"] = h.Name h.fieldMap["status"] = h.Status h.fieldMap["uptime_percentage"] = h.UptimePercentage h.fieldMap["schedule"] = h.Schedule h.fieldMap["url"] = h.URL h.fieldMap["method"] = h.Method } func (h healthcheckHttp) clone(db *gorm.DB) healthcheckHttp { h.healthcheckHttpDo.ReplaceConnPool(db.Statement.ConnPool) return h } func (h healthcheckHttp) replaceDB(db *gorm.DB) healthcheckHttp { h.healthcheckHttpDo.ReplaceDB(db) return h } type healthcheckHttpDo struct{ gen.DO } type IHealthcheckHttpDo interface { gen.SubQuery Debug() IHealthcheckHttpDo WithContext(ctx context.Context) IHealthcheckHttpDo WithResult(fc func(tx gen.Dao)) gen.ResultInfo ReplaceDB(db *gorm.DB) ReadDB() IHealthcheckHttpDo WriteDB() IHealthcheckHttpDo As(alias string) gen.Dao Session(config *gorm.Session) IHealthcheckHttpDo Columns(cols ...field.Expr) gen.Columns Clauses(conds ...clause.Expression) IHealthcheckHttpDo Not(conds ...gen.Condition) IHealthcheckHttpDo Or(conds ...gen.Condition) IHealthcheckHttpDo Select(conds ...field.Expr) IHealthcheckHttpDo Where(conds ...gen.Condition) IHealthcheckHttpDo Order(conds ...field.Expr) IHealthcheckHttpDo Distinct(cols ...field.Expr) IHealthcheckHttpDo Omit(cols ...field.Expr) IHealthcheckHttpDo Join(table schema.Tabler, on ...field.Expr) IHealthcheckHttpDo LeftJoin(table schema.Tabler, on ...field.Expr) IHealthcheckHttpDo RightJoin(table schema.Tabler, on ...field.Expr) IHealthcheckHttpDo Group(cols ...field.Expr) IHealthcheckHttpDo Having(conds ...gen.Condition) IHealthcheckHttpDo Limit(limit int) IHealthcheckHttpDo Offset(offset int) IHealthcheckHttpDo Count() (count int64, err error) Scopes(funcs ...func(gen.Dao) gen.Dao) IHealthcheckHttpDo Unscoped() IHealthcheckHttpDo Create(values ...*models.HealthcheckHttp) error CreateInBatches(values []*models.HealthcheckHttp, batchSize int) error Save(values ...*models.HealthcheckHttp) error First() (*models.HealthcheckHttp, error) Take() (*models.HealthcheckHttp, error) Last() (*models.HealthcheckHttp, error) Find() ([]*models.HealthcheckHttp, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.HealthcheckHttp, err error) FindInBatches(result *[]*models.HealthcheckHttp, batchSize int, fc func(tx gen.Dao, batch int) error) error Pluck(column field.Expr, dest interface{}) error Delete(...*models.HealthcheckHttp) (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) IHealthcheckHttpDo Assign(attrs ...field.AssignExpr) IHealthcheckHttpDo Joins(fields ...field.RelationField) IHealthcheckHttpDo Preload(fields ...field.RelationField) IHealthcheckHttpDo FirstOrInit() (*models.HealthcheckHttp, error) FirstOrCreate() (*models.HealthcheckHttp, error) FindByPage(offset int, limit int) (result []*models.HealthcheckHttp, 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) IHealthcheckHttpDo UnderlyingDB() *gorm.DB schema.Tabler } func (h healthcheckHttpDo) Debug() IHealthcheckHttpDo { return h.withDO(h.DO.Debug()) } func (h healthcheckHttpDo) WithContext(ctx context.Context) IHealthcheckHttpDo { return h.withDO(h.DO.WithContext(ctx)) } func (h healthcheckHttpDo) ReadDB() IHealthcheckHttpDo { return h.Clauses(dbresolver.Read) } func (h healthcheckHttpDo) WriteDB() IHealthcheckHttpDo { return h.Clauses(dbresolver.Write) } func (h healthcheckHttpDo) Session(config *gorm.Session) IHealthcheckHttpDo { return h.withDO(h.DO.Session(config)) } func (h healthcheckHttpDo) Clauses(conds ...clause.Expression) IHealthcheckHttpDo { return h.withDO(h.DO.Clauses(conds...)) } func (h healthcheckHttpDo) Returning(value interface{}, columns ...string) IHealthcheckHttpDo { return h.withDO(h.DO.Returning(value, columns...)) } func (h healthcheckHttpDo) Not(conds ...gen.Condition) IHealthcheckHttpDo { return h.withDO(h.DO.Not(conds...)) } func (h healthcheckHttpDo) Or(conds ...gen.Condition) IHealthcheckHttpDo { return h.withDO(h.DO.Or(conds...)) } func (h healthcheckHttpDo) Select(conds ...field.Expr) IHealthcheckHttpDo { return h.withDO(h.DO.Select(conds...)) } func (h healthcheckHttpDo) Where(conds ...gen.Condition) IHealthcheckHttpDo { return h.withDO(h.DO.Where(conds...)) } func (h healthcheckHttpDo) Order(conds ...field.Expr) IHealthcheckHttpDo { return h.withDO(h.DO.Order(conds...)) } func (h healthcheckHttpDo) Distinct(cols ...field.Expr) IHealthcheckHttpDo { return h.withDO(h.DO.Distinct(cols...)) } func (h healthcheckHttpDo) Omit(cols ...field.Expr) IHealthcheckHttpDo { return h.withDO(h.DO.Omit(cols...)) } func (h healthcheckHttpDo) Join(table schema.Tabler, on ...field.Expr) IHealthcheckHttpDo { return h.withDO(h.DO.Join(table, on...)) } func (h healthcheckHttpDo) LeftJoin(table schema.Tabler, on ...field.Expr) IHealthcheckHttpDo { return h.withDO(h.DO.LeftJoin(table, on...)) } func (h healthcheckHttpDo) RightJoin(table schema.Tabler, on ...field.Expr) IHealthcheckHttpDo { return h.withDO(h.DO.RightJoin(table, on...)) } func (h healthcheckHttpDo) Group(cols ...field.Expr) IHealthcheckHttpDo { return h.withDO(h.DO.Group(cols...)) } func (h healthcheckHttpDo) Having(conds ...gen.Condition) IHealthcheckHttpDo { return h.withDO(h.DO.Having(conds...)) } func (h healthcheckHttpDo) Limit(limit int) IHealthcheckHttpDo { return h.withDO(h.DO.Limit(limit)) } func (h healthcheckHttpDo) Offset(offset int) IHealthcheckHttpDo { return h.withDO(h.DO.Offset(offset)) } func (h healthcheckHttpDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IHealthcheckHttpDo { return h.withDO(h.DO.Scopes(funcs...)) } func (h healthcheckHttpDo) Unscoped() IHealthcheckHttpDo { return h.withDO(h.DO.Unscoped()) } func (h healthcheckHttpDo) Create(values ...*models.HealthcheckHttp) error { if len(values) == 0 { return nil } return h.DO.Create(values) } func (h healthcheckHttpDo) CreateInBatches(values []*models.HealthcheckHttp, 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 healthcheckHttpDo) Save(values ...*models.HealthcheckHttp) error { if len(values) == 0 { return nil } return h.DO.Save(values) } func (h healthcheckHttpDo) First() (*models.HealthcheckHttp, error) { if result, err := h.DO.First(); err != nil { return nil, err } else { return result.(*models.HealthcheckHttp), nil } } func (h healthcheckHttpDo) Take() (*models.HealthcheckHttp, error) { if result, err := h.DO.Take(); err != nil { return nil, err } else { return result.(*models.HealthcheckHttp), nil } } func (h healthcheckHttpDo) Last() (*models.HealthcheckHttp, error) { if result, err := h.DO.Last(); err != nil { return nil, err } else { return result.(*models.HealthcheckHttp), nil } } func (h healthcheckHttpDo) Find() ([]*models.HealthcheckHttp, error) { result, err := h.DO.Find() return result.([]*models.HealthcheckHttp), err } func (h healthcheckHttpDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.HealthcheckHttp, err error) { buf := make([]*models.HealthcheckHttp, 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 healthcheckHttpDo) FindInBatches(result *[]*models.HealthcheckHttp, batchSize int, fc func(tx gen.Dao, batch int) error) error { return h.DO.FindInBatches(result, batchSize, fc) } func (h healthcheckHttpDo) Attrs(attrs ...field.AssignExpr) IHealthcheckHttpDo { return h.withDO(h.DO.Attrs(attrs...)) } func (h healthcheckHttpDo) Assign(attrs ...field.AssignExpr) IHealthcheckHttpDo { return h.withDO(h.DO.Assign(attrs...)) } func (h healthcheckHttpDo) Joins(fields ...field.RelationField) IHealthcheckHttpDo { for _, _f := range fields { h = *h.withDO(h.DO.Joins(_f)) } return &h } func (h healthcheckHttpDo) Preload(fields ...field.RelationField) IHealthcheckHttpDo { for _, _f := range fields { h = *h.withDO(h.DO.Preload(_f)) } return &h } func (h healthcheckHttpDo) FirstOrInit() (*models.HealthcheckHttp, error) { if result, err := h.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*models.HealthcheckHttp), nil } } func (h healthcheckHttpDo) FirstOrCreate() (*models.HealthcheckHttp, error) { if result, err := h.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*models.HealthcheckHttp), nil } } func (h healthcheckHttpDo) FindByPage(offset int, limit int) (result []*models.HealthcheckHttp, 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 healthcheckHttpDo) 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 healthcheckHttpDo) Scan(result interface{}) (err error) { return h.DO.Scan(result) } func (h healthcheckHttpDo) Delete(models ...*models.HealthcheckHttp) (result gen.ResultInfo, err error) { return h.DO.Delete(models) } func (h *healthcheckHttpDo) withDO(do gen.Dao) *healthcheckHttpDo { h.DO = *do.(*gen.DO) return h }