db

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAll

func CheckAll(db *gorm.DB)

Types

type Check

type Check struct {
	ID                  string    `gorm:"primaryKey"`
	Name                string    `gorm:"uniqueIndex:checkname;index;not null"`
	NamespaceID         string    `gorm:"uniqueIndex:checkname;index;not null"`
	Namespace           Namespace `gorm:"foreignKey:NamespaceID"`
	Type                check.Type
	Data                datatypes.JSON
	Frecuency           string
	Status              Status
	ErrorMsg            string
	Uptime24h           float64
	Uptime7d            float64
	Uptime30d           float64
	Message             string
	LatestCheck         time.Time
	CreatedAt           time.Time
	UpdatedAt           time.Time
	DeletedAt           gorm.DeletedAt `gorm:"index"`
	LastFailureNotified *time.Time
	LastWarningNotified *time.Time
	FailureCount        int
	WarningCount        int
	StatusPages         []PageCheck `gorm:"foreignKey:CheckID"`
	Executions          []CheckExecution
}

func (*Check) Check

func (c *Check) Check(db *gorm.DB)

func (Check) GetHttpData

func (c Check) GetHttpData() (*HttpCheckData, error)

func (Check) GetIcmpData

func (c Check) GetIcmpData() (*IcmpCheckData, error)

func (Check) GetTcpData

func (c Check) GetTcpData() (*TcpCheckData, error)

func (Check) GetTlsData

func (c Check) GetTlsData() (*TlsCheckData, error)

func (Check) TableName

func (Check) TableName() string

type CheckExecution

type CheckExecution struct {
	ID        string `gorm:"primaryKey"`
	Status    Status
	CreatedAt time.Time
	UpdatedAt time.Time
	ErrorMsg  string
	Message   string
	Stats     datatypes.JSON
	CheckID   string
	Check     Check `gorm:"foreignKey:CheckID"`
}

func (CheckExecution) TableName

func (CheckExecution) TableName() string

type HttpCheckData

type HttpCheckData struct {
	Url                        string `json:"url"`
	StatusCode                 int    `json:"status_code"`
	CertificateExpirationDelta string `json:"certificateExpirationDelta"`
}

type IcmpCheckData

type IcmpCheckData struct {
	Address string `json:"address"`
}

type Namespace

type Namespace struct {
	ID        string `gorm:"primary_key"`
	Name      string `gorm:"uniqueIndex"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type PageCheck

type PageCheck struct {
	CheckID      string     `gorm:"primaryKey"`
	Check        Check      `gorm:"foreignKey:CheckID"`
	StatusPageID string     `gorm:"primaryKey;uniqueIndex:pagecheckorder;index;not null"`
	StatusPage   StatusPage `gorm:"foreignKey:StatusPageID"`
	Order        int        `gorm:"uniqueIndex:pagecheckorder;index"`
	CreatedAt    time.Time
}

type Status

type Status string
const (
	Up        Status = "UP"
	Scheduled Status = "SCHEDULED"
	Checking  Status = "CHECKING"
	Down      Status = "DOWN"
)

type StatusPage

type StatusPage struct {
	ID          string `gorm:"primary_key"`
	Title       string
	Name        string    `gorm:"uniqueIndex:statusslugns;index;not null"`
	Slug        string    `gorm:"uniqueIndex"`
	NamespaceID string    `gorm:"uniqueIndex:statusslugns;index;not null"`
	Namespace   Namespace `gorm:"foreignKey:NamespaceID"`
	Data        datatypes.JSON
	Checks      []PageCheck `gorm:"foreignKey:StatusPageID"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt `gorm:"index"`
}

func (StatusPage) GetData

func (s StatusPage) GetData() (*StatusPageData, error)

func (StatusPage) TableName

func (StatusPage) TableName() string

type StatusPageData

type StatusPageData struct {
	OrderChecks []string
}

type TcpCheckData

type TcpCheckData struct {
	Address string `json:"address"`
}

type TlsCheckData

type TlsCheckData struct {
	Address string `json:"address"`
	RootCAs string `json:"root_cas"`
}

Jump to

Keyboard shortcuts

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