checkins

package
v0.0.0-...-39e0c7e Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Samples

func Samples() error

func SamplesChkHits

func SamplesChkHits() error

func SetDB

func SetDB(database database.Database)

Types

type Checkin

type Checkin struct {
	Id          int64               `gorm:"primary_key;column:id" json:"id"`
	ServiceId   int64               `gorm:"index;column:service" json:"service_id"`
	Name        string              `gorm:"column:name" json:"name"`
	Interval    int64               `gorm:"column:check_interval" json:"interval"`
	ApiKey      string              `gorm:"column:api_key"  json:"api_key"`
	CreatedAt   time.Time           `gorm:"column:created_at" json:"created_at"`
	UpdatedAt   time.Time           `gorm:"column:updated_at" json:"updated_at"`
	Running     chan bool           `gorm:"-" json:"-"`
	Failing     bool                `gorm:"-" json:"failing"`
	LastHitTime time.Time           `gorm:"-" json:"last_hit"`
	AllHits     []*CheckinHit       `gorm:"-" json:"hits"`
	AllFailures []*failures.Failure `gorm:"-" json:"failures"`
}

Checkin struct will allow an application to send a recurring HTTP GET to confirm a service is online

func All

func All() []*Checkin

func Find

func Find(id int64) (*Checkin, error)

func FindByAPI

func FindByAPI(key string) (*Checkin, error)

func (*Checkin) AfterFind

func (c *Checkin) AfterFind()

func (*Checkin) Close

func (c *Checkin) Close()

Close will stop the checkin routine

func (*Checkin) Create

func (c *Checkin) Create() error

func (*Checkin) CreateFailure

func (c *Checkin) CreateFailure(f *failures.Failure) error

func (*Checkin) Delete

func (c *Checkin) Delete() error

func (*Checkin) Expected

func (c *Checkin) Expected() time.Duration

func (*Checkin) Failures

func (c *Checkin) Failures() failures.Failurer

func (*Checkin) FailuresColumnID

func (c *Checkin) FailuresColumnID() (string, int64)

func (*Checkin) FailuresSince

func (c *Checkin) FailuresSince(t time.Time) failures.Failurer

func (*Checkin) Hits

func (c *Checkin) Hits() []*CheckinHit

func (*Checkin) IsRunning

func (c *Checkin) IsRunning() bool

IsRunning returns true if the checkin go routine is running

func (*Checkin) LastHit

func (c *Checkin) LastHit() *CheckinHit

func (*Checkin) Period

func (c *Checkin) Period() time.Duration

func (*Checkin) Start

func (c *Checkin) Start()

Start will create a channel for the checkin checking go routine

func (*Checkin) Update

func (c *Checkin) Update() error

type CheckinHit

type CheckinHit struct {
	Id        int64     `gorm:"primary_key;column:id" json:"id"`
	Checkin   int64     `gorm:"index;column:checkin" json:"-"`
	From      string    `gorm:"column:from_location" json:"from"`
	CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
}

CheckinHit is a successful response from a Checkin

func (*CheckinHit) Create

func (c *CheckinHit) Create() error

func (*CheckinHit) Delete

func (c *CheckinHit) Delete() error

func (*CheckinHit) Update

func (c *CheckinHit) Update() error

Jump to

Keyboard shortcuts

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