models

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CronScheduledMap map[string]cron.EntryID
View Source
var WatcherContinueErrorTimesMap map[string]int
View Source
var WatcherLastStatusMap map[string]bool

Functions

This section is empty.

Types

type CheckResult

type CheckResult struct {
	Name         string
	Status       bool
	ResponseTime int64 // ms
}

type Watcher

type Watcher struct {
	ID       string            `gorm:"primaryKey"`
	Type     enums.WatcherType `json:"type"` // Type of the watcher
	Name     string            `json:"name" validate:"required"`
	Location string            `json:"location" validate:"required,url"`    // URL or IP
	Interval int               `json:"interval" validate:"required,min=10"` // Interval to check the service
	IsEnable bool              `json:"is_enable"`                           // Enable or disable the watcher
}

func (*Watcher) AddContinueErrorTimes

func (w *Watcher) AddContinueErrorTimes()

func (*Watcher) BeforeCreate

func (w *Watcher) BeforeCreate(_ *gorm.DB) (err error)

BeforeCreate will set snowflake id rather than numeric id.

func (*Watcher) GetContinueErrorTimes

func (w *Watcher) GetContinueErrorTimes() int

func (*Watcher) GetCronExpression

func (w *Watcher) GetCronExpression() string

func (*Watcher) GetCronExpressionWithContinuesErrorTimes

func (w *Watcher) GetCronExpressionWithContinuesErrorTimes() string

func (*Watcher) GetCronID

func (w *Watcher) GetCronID() cron.EntryID

func (*Watcher) GetLastStatus

func (w *Watcher) GetLastStatus() bool

func (*Watcher) RemoveContinueErrorTimes added in v1.0.1

func (w *Watcher) RemoveContinueErrorTimes()

func (*Watcher) RemoveCronID added in v1.0.1

func (w *Watcher) RemoveCronID()

func (*Watcher) RemoveLastStatus added in v1.0.1

func (w *Watcher) RemoveLastStatus()

func (*Watcher) SetCronID

func (w *Watcher) SetCronID(id cron.EntryID)

func (*Watcher) SetLastStatus

func (w *Watcher) SetLastStatus(b bool)

Jump to

Keyboard shortcuts

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