mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-29 18:51:22 +00:00
487 lines
16 KiB
Go
487 lines
16 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 newHealthcheckTcpHistory(db *gorm.DB, opts ...gen.DOOption) healthcheckTcpHistory {
|
||
|
_healthcheckTcpHistory := healthcheckTcpHistory{}
|
||
|
|
||
|
_healthcheckTcpHistory.healthcheckTcpHistoryDo.UseDB(db, opts...)
|
||
|
_healthcheckTcpHistory.healthcheckTcpHistoryDo.UseModel(&models.HealthcheckTcpHistory{})
|
||
|
|
||
|
tableName := _healthcheckTcpHistory.healthcheckTcpHistoryDo.TableName()
|
||
|
_healthcheckTcpHistory.ALL = field.NewAsterisk(tableName)
|
||
|
_healthcheckTcpHistory.ID = field.NewUint(tableName, "id")
|
||
|
_healthcheckTcpHistory.CreatedAt = field.NewTime(tableName, "created_at")
|
||
|
_healthcheckTcpHistory.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||
|
_healthcheckTcpHistory.DeletedAt = field.NewField(tableName, "deleted_at")
|
||
|
_healthcheckTcpHistory.Status = field.NewString(tableName, "status")
|
||
|
_healthcheckTcpHistory.HealthcheckTCP = healthcheckTcpHistoryHasOneHealthcheckTCP{
|
||
|
db: db.Session(&gorm.Session{}),
|
||
|
|
||
|
RelationField: field.NewRelation("HealthcheckTCP", "models.HealthcheckTcp"),
|
||
|
}
|
||
|
|
||
|
_healthcheckTcpHistory.fillFieldMap()
|
||
|
|
||
|
return _healthcheckTcpHistory
|
||
|
}
|
||
|
|
||
|
type healthcheckTcpHistory struct {
|
||
|
healthcheckTcpHistoryDo healthcheckTcpHistoryDo
|
||
|
|
||
|
ALL field.Asterisk
|
||
|
ID field.Uint
|
||
|
CreatedAt field.Time
|
||
|
UpdatedAt field.Time
|
||
|
DeletedAt field.Field
|
||
|
Status field.String
|
||
|
HealthcheckTCP healthcheckTcpHistoryHasOneHealthcheckTCP
|
||
|
|
||
|
fieldMap map[string]field.Expr
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistory) Table(newTableName string) *healthcheckTcpHistory {
|
||
|
h.healthcheckTcpHistoryDo.UseTable(newTableName)
|
||
|
return h.updateTableName(newTableName)
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistory) As(alias string) *healthcheckTcpHistory {
|
||
|
h.healthcheckTcpHistoryDo.DO = *(h.healthcheckTcpHistoryDo.As(alias).(*gen.DO))
|
||
|
return h.updateTableName(alias)
|
||
|
}
|
||
|
|
||
|
func (h *healthcheckTcpHistory) updateTableName(table string) *healthcheckTcpHistory {
|
||
|
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 *healthcheckTcpHistory) WithContext(ctx context.Context) IHealthcheckTcpHistoryDo {
|
||
|
return h.healthcheckTcpHistoryDo.WithContext(ctx)
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistory) TableName() string { return h.healthcheckTcpHistoryDo.TableName() }
|
||
|
|
||
|
func (h healthcheckTcpHistory) Alias() string { return h.healthcheckTcpHistoryDo.Alias() }
|
||
|
|
||
|
func (h healthcheckTcpHistory) Columns(cols ...field.Expr) gen.Columns {
|
||
|
return h.healthcheckTcpHistoryDo.Columns(cols...)
|
||
|
}
|
||
|
|
||
|
func (h *healthcheckTcpHistory) 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 *healthcheckTcpHistory) 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 healthcheckTcpHistory) clone(db *gorm.DB) healthcheckTcpHistory {
|
||
|
h.healthcheckTcpHistoryDo.ReplaceConnPool(db.Statement.ConnPool)
|
||
|
return h
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistory) replaceDB(db *gorm.DB) healthcheckTcpHistory {
|
||
|
h.healthcheckTcpHistoryDo.ReplaceDB(db)
|
||
|
return h
|
||
|
}
|
||
|
|
||
|
type healthcheckTcpHistoryHasOneHealthcheckTCP struct {
|
||
|
db *gorm.DB
|
||
|
|
||
|
field.RelationField
|
||
|
}
|
||
|
|
||
|
func (a healthcheckTcpHistoryHasOneHealthcheckTCP) Where(conds ...field.Expr) *healthcheckTcpHistoryHasOneHealthcheckTCP {
|
||
|
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 healthcheckTcpHistoryHasOneHealthcheckTCP) WithContext(ctx context.Context) *healthcheckTcpHistoryHasOneHealthcheckTCP {
|
||
|
a.db = a.db.WithContext(ctx)
|
||
|
return &a
|
||
|
}
|
||
|
|
||
|
func (a healthcheckTcpHistoryHasOneHealthcheckTCP) Session(session *gorm.Session) *healthcheckTcpHistoryHasOneHealthcheckTCP {
|
||
|
a.db = a.db.Session(session)
|
||
|
return &a
|
||
|
}
|
||
|
|
||
|
func (a healthcheckTcpHistoryHasOneHealthcheckTCP) Model(m *models.HealthcheckTcpHistory) *healthcheckTcpHistoryHasOneHealthcheckTCPTx {
|
||
|
return &healthcheckTcpHistoryHasOneHealthcheckTCPTx{a.db.Model(m).Association(a.Name())}
|
||
|
}
|
||
|
|
||
|
type healthcheckTcpHistoryHasOneHealthcheckTCPTx struct{ tx *gorm.Association }
|
||
|
|
||
|
func (a healthcheckTcpHistoryHasOneHealthcheckTCPTx) Find() (result *models.HealthcheckTcp, err error) {
|
||
|
return result, a.tx.Find(&result)
|
||
|
}
|
||
|
|
||
|
func (a healthcheckTcpHistoryHasOneHealthcheckTCPTx) Append(values ...*models.HealthcheckTcp) (err error) {
|
||
|
targetValues := make([]interface{}, len(values))
|
||
|
for i, v := range values {
|
||
|
targetValues[i] = v
|
||
|
}
|
||
|
return a.tx.Append(targetValues...)
|
||
|
}
|
||
|
|
||
|
func (a healthcheckTcpHistoryHasOneHealthcheckTCPTx) Replace(values ...*models.HealthcheckTcp) (err error) {
|
||
|
targetValues := make([]interface{}, len(values))
|
||
|
for i, v := range values {
|
||
|
targetValues[i] = v
|
||
|
}
|
||
|
return a.tx.Replace(targetValues...)
|
||
|
}
|
||
|
|
||
|
func (a healthcheckTcpHistoryHasOneHealthcheckTCPTx) Delete(values ...*models.HealthcheckTcp) (err error) {
|
||
|
targetValues := make([]interface{}, len(values))
|
||
|
for i, v := range values {
|
||
|
targetValues[i] = v
|
||
|
}
|
||
|
return a.tx.Delete(targetValues...)
|
||
|
}
|
||
|
|
||
|
func (a healthcheckTcpHistoryHasOneHealthcheckTCPTx) Clear() error {
|
||
|
return a.tx.Clear()
|
||
|
}
|
||
|
|
||
|
func (a healthcheckTcpHistoryHasOneHealthcheckTCPTx) Count() int64 {
|
||
|
return a.tx.Count()
|
||
|
}
|
||
|
|
||
|
type healthcheckTcpHistoryDo struct{ gen.DO }
|
||
|
|
||
|
type IHealthcheckTcpHistoryDo interface {
|
||
|
gen.SubQuery
|
||
|
Debug() IHealthcheckTcpHistoryDo
|
||
|
WithContext(ctx context.Context) IHealthcheckTcpHistoryDo
|
||
|
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||
|
ReplaceDB(db *gorm.DB)
|
||
|
ReadDB() IHealthcheckTcpHistoryDo
|
||
|
WriteDB() IHealthcheckTcpHistoryDo
|
||
|
As(alias string) gen.Dao
|
||
|
Session(config *gorm.Session) IHealthcheckTcpHistoryDo
|
||
|
Columns(cols ...field.Expr) gen.Columns
|
||
|
Clauses(conds ...clause.Expression) IHealthcheckTcpHistoryDo
|
||
|
Not(conds ...gen.Condition) IHealthcheckTcpHistoryDo
|
||
|
Or(conds ...gen.Condition) IHealthcheckTcpHistoryDo
|
||
|
Select(conds ...field.Expr) IHealthcheckTcpHistoryDo
|
||
|
Where(conds ...gen.Condition) IHealthcheckTcpHistoryDo
|
||
|
Order(conds ...field.Expr) IHealthcheckTcpHistoryDo
|
||
|
Distinct(cols ...field.Expr) IHealthcheckTcpHistoryDo
|
||
|
Omit(cols ...field.Expr) IHealthcheckTcpHistoryDo
|
||
|
Join(table schema.Tabler, on ...field.Expr) IHealthcheckTcpHistoryDo
|
||
|
LeftJoin(table schema.Tabler, on ...field.Expr) IHealthcheckTcpHistoryDo
|
||
|
RightJoin(table schema.Tabler, on ...field.Expr) IHealthcheckTcpHistoryDo
|
||
|
Group(cols ...field.Expr) IHealthcheckTcpHistoryDo
|
||
|
Having(conds ...gen.Condition) IHealthcheckTcpHistoryDo
|
||
|
Limit(limit int) IHealthcheckTcpHistoryDo
|
||
|
Offset(offset int) IHealthcheckTcpHistoryDo
|
||
|
Count() (count int64, err error)
|
||
|
Scopes(funcs ...func(gen.Dao) gen.Dao) IHealthcheckTcpHistoryDo
|
||
|
Unscoped() IHealthcheckTcpHistoryDo
|
||
|
Create(values ...*models.HealthcheckTcpHistory) error
|
||
|
CreateInBatches(values []*models.HealthcheckTcpHistory, batchSize int) error
|
||
|
Save(values ...*models.HealthcheckTcpHistory) error
|
||
|
First() (*models.HealthcheckTcpHistory, error)
|
||
|
Take() (*models.HealthcheckTcpHistory, error)
|
||
|
Last() (*models.HealthcheckTcpHistory, error)
|
||
|
Find() ([]*models.HealthcheckTcpHistory, error)
|
||
|
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.HealthcheckTcpHistory, err error)
|
||
|
FindInBatches(result *[]*models.HealthcheckTcpHistory, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||
|
Pluck(column field.Expr, dest interface{}) error
|
||
|
Delete(...*models.HealthcheckTcpHistory) (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) IHealthcheckTcpHistoryDo
|
||
|
Assign(attrs ...field.AssignExpr) IHealthcheckTcpHistoryDo
|
||
|
Joins(fields ...field.RelationField) IHealthcheckTcpHistoryDo
|
||
|
Preload(fields ...field.RelationField) IHealthcheckTcpHistoryDo
|
||
|
FirstOrInit() (*models.HealthcheckTcpHistory, error)
|
||
|
FirstOrCreate() (*models.HealthcheckTcpHistory, error)
|
||
|
FindByPage(offset int, limit int) (result []*models.HealthcheckTcpHistory, 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) IHealthcheckTcpHistoryDo
|
||
|
UnderlyingDB() *gorm.DB
|
||
|
schema.Tabler
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Debug() IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Debug())
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) WithContext(ctx context.Context) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.WithContext(ctx))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) ReadDB() IHealthcheckTcpHistoryDo {
|
||
|
return h.Clauses(dbresolver.Read)
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) WriteDB() IHealthcheckTcpHistoryDo {
|
||
|
return h.Clauses(dbresolver.Write)
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Session(config *gorm.Session) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Session(config))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Clauses(conds ...clause.Expression) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Clauses(conds...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Returning(value interface{}, columns ...string) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Returning(value, columns...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Not(conds ...gen.Condition) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Not(conds...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Or(conds ...gen.Condition) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Or(conds...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Select(conds ...field.Expr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Select(conds...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Where(conds ...gen.Condition) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Where(conds...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Order(conds ...field.Expr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Order(conds...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Distinct(cols ...field.Expr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Distinct(cols...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Omit(cols ...field.Expr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Omit(cols...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Join(table schema.Tabler, on ...field.Expr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Join(table, on...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) LeftJoin(table schema.Tabler, on ...field.Expr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.LeftJoin(table, on...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) RightJoin(table schema.Tabler, on ...field.Expr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.RightJoin(table, on...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Group(cols ...field.Expr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Group(cols...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Having(conds ...gen.Condition) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Having(conds...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Limit(limit int) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Limit(limit))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Offset(offset int) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Offset(offset))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Scopes(funcs...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Unscoped() IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Unscoped())
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Create(values ...*models.HealthcheckTcpHistory) error {
|
||
|
if len(values) == 0 {
|
||
|
return nil
|
||
|
}
|
||
|
return h.DO.Create(values)
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) CreateInBatches(values []*models.HealthcheckTcpHistory, 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 healthcheckTcpHistoryDo) Save(values ...*models.HealthcheckTcpHistory) error {
|
||
|
if len(values) == 0 {
|
||
|
return nil
|
||
|
}
|
||
|
return h.DO.Save(values)
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) First() (*models.HealthcheckTcpHistory, error) {
|
||
|
if result, err := h.DO.First(); err != nil {
|
||
|
return nil, err
|
||
|
} else {
|
||
|
return result.(*models.HealthcheckTcpHistory), nil
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Take() (*models.HealthcheckTcpHistory, error) {
|
||
|
if result, err := h.DO.Take(); err != nil {
|
||
|
return nil, err
|
||
|
} else {
|
||
|
return result.(*models.HealthcheckTcpHistory), nil
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Last() (*models.HealthcheckTcpHistory, error) {
|
||
|
if result, err := h.DO.Last(); err != nil {
|
||
|
return nil, err
|
||
|
} else {
|
||
|
return result.(*models.HealthcheckTcpHistory), nil
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Find() ([]*models.HealthcheckTcpHistory, error) {
|
||
|
result, err := h.DO.Find()
|
||
|
return result.([]*models.HealthcheckTcpHistory), err
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.HealthcheckTcpHistory, err error) {
|
||
|
buf := make([]*models.HealthcheckTcpHistory, 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 healthcheckTcpHistoryDo) FindInBatches(result *[]*models.HealthcheckTcpHistory, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||
|
return h.DO.FindInBatches(result, batchSize, fc)
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Attrs(attrs ...field.AssignExpr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Attrs(attrs...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Assign(attrs ...field.AssignExpr) IHealthcheckTcpHistoryDo {
|
||
|
return h.withDO(h.DO.Assign(attrs...))
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Joins(fields ...field.RelationField) IHealthcheckTcpHistoryDo {
|
||
|
for _, _f := range fields {
|
||
|
h = *h.withDO(h.DO.Joins(_f))
|
||
|
}
|
||
|
return &h
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Preload(fields ...field.RelationField) IHealthcheckTcpHistoryDo {
|
||
|
for _, _f := range fields {
|
||
|
h = *h.withDO(h.DO.Preload(_f))
|
||
|
}
|
||
|
return &h
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) FirstOrInit() (*models.HealthcheckTcpHistory, error) {
|
||
|
if result, err := h.DO.FirstOrInit(); err != nil {
|
||
|
return nil, err
|
||
|
} else {
|
||
|
return result.(*models.HealthcheckTcpHistory), nil
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) FirstOrCreate() (*models.HealthcheckTcpHistory, error) {
|
||
|
if result, err := h.DO.FirstOrCreate(); err != nil {
|
||
|
return nil, err
|
||
|
} else {
|
||
|
return result.(*models.HealthcheckTcpHistory), nil
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) FindByPage(offset int, limit int) (result []*models.HealthcheckTcpHistory, 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 healthcheckTcpHistoryDo) 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 healthcheckTcpHistoryDo) Scan(result interface{}) (err error) {
|
||
|
return h.DO.Scan(result)
|
||
|
}
|
||
|
|
||
|
func (h healthcheckTcpHistoryDo) Delete(models ...*models.HealthcheckTcpHistory) (result gen.ResultInfo, err error) {
|
||
|
return h.DO.Delete(models)
|
||
|
}
|
||
|
|
||
|
func (h *healthcheckTcpHistoryDo) withDO(do gen.Dao) *healthcheckTcpHistoryDo {
|
||
|
h.DO = *do.(*gen.DO)
|
||
|
return h
|
||
|
}
|