db

package
v0.0.0-...-e0f479a Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	DB        *sql.DB
	Connected bool
}

func (*Connection) AddService

func (r *Connection) AddService(s Service) error

func (*Connection) Connect

func (r *Connection) Connect() error

func (*Connection) GetDetails

func (r *Connection) GetDetails(name string) (DetailStats, error)

func (*Connection) GetStats

func (r *Connection) GetStats() (Stats, error)

func (*Connection) LogOK

func (r *Connection) LogOK(o Outage) error

func (*Connection) LogOutage

func (r *Connection) LogOutage(o Outage) error

func (*Connection) Migrate

func (r *Connection) Migrate() error

func (*Connection) RemoveService

func (r *Connection) RemoveService(s Service) error

type DetailStats

type DetailStats struct {
	Status        bool    `json:"status"`
	TimeMonitored int64   `json:"time_monitored"`
	Downtime      int64   `json:"downtime"`
	OutageStart   []int64 `json:"outage_start"`
	OutageEnd     []int64 `json:"outage_end"`
}

type Outage

type Outage struct {
	ServiceName string `sql:"Service"`
	OutageStart int64  `sql:"Start"`
	OutageEnd   int64  `sql:"End"`
}

type Service

type Service struct {
	ServiceName     string `sql:"Name"`
	ServiceURL      string `sql:"URL"`
	Status          bool   `sql:"OK"`
	MonitoringSince int64  `sql:"Since"`
}

type Stats

type Stats struct {
	ServiceName []string `json:"service_name"`
	ServiceURL  []string `json:"service_url"`
	Status      []bool   `json:"status"`
}

Jump to

Keyboard shortcuts

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