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