models

package
v0.26.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropDB

func DropDB() error

DropDB 删除 Heartbeat 插件相关的表及数据

func InitDB

func InitDB() error

InitDB 初始化数据库表(GORM自动迁移)

func UpgradeDB

func UpgradeDB(fromVersion string, toVersion string) error

UpgradeDB 升级 Heartbeat 插件数据库结构与数据

Types

type HeartbeatSetting

type HeartbeatSetting struct {
	ID                          uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"`
	HeartbeatIntervalSeconds    int  `gorm:"default:30" json:"heartbeat_interval_seconds"`       // 心跳间隔时间(秒)
	HeartbeatFailureThreshold   int  `gorm:"default:3" json:"heartbeat_failure_threshold"`       // 心跳失败阈值
	ReconnectMaxIntervalSeconds int  `gorm:"default:3600" json:"reconnect_max_interval_seconds"` // 重连最大间隔时间(秒)
	MaxRetryAttempts            int  `gorm:"default:100" json:"max_retry_attempts"`              // 最大重试次数,默认100次
}

func DefaultHeartbeatSetting

func DefaultHeartbeatSetting() *HeartbeatSetting

func GetOrCreateHeartbeatSetting

func GetOrCreateHeartbeatSetting() (*HeartbeatSetting, error)

func UpdateHeartbeatSetting

func UpdateHeartbeatSetting(in *HeartbeatSetting) (*HeartbeatSetting, error)

func (HeartbeatSetting) TableName

func (HeartbeatSetting) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL