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