statping: github.com/hunterlong/statping/types/checkins Index | Files

package checkins

import "github.com/hunterlong/statping/types/checkins"

Index

Package Files

database.go database_hits.go failures.go generate.go methods.go routine.go samples.go struct.go

func Samples Uses

func Samples() error

func SamplesChkHits Uses

func SamplesChkHits() error

func SetDB Uses

func SetDB(database database.Database)

type Checkin Uses

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"`
    GracePeriod int64               `gorm:"column:grace_period"  json:"grace"`
    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 Uses

func All() []*Checkin

func Find Uses

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

func FindByAPI Uses

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

func (*Checkin) BeforeCreate Uses

func (c *Checkin) BeforeCreate() (err error)

func (*Checkin) CheckinRoutine Uses

func (c *Checkin) CheckinRoutine()

Routine for checking if the last Checkin was within its interval

func (*Checkin) Close Uses

func (c *Checkin) Close()

Close will stop the checkin routine

func (*Checkin) Create Uses

func (c *Checkin) Create() error

func (*Checkin) CreateFailure Uses

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

func (*Checkin) Delete Uses

func (c *Checkin) Delete() error

func (*Checkin) Expected Uses

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

func (*Checkin) Failures Uses

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

func (*Checkin) FailuresColumnID Uses

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

func (*Checkin) FailuresSince Uses

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

func (*Checkin) Grace Uses

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

Grace will return the duration of the Checkin Grace Period (after service hasn't responded, wait a bit for a response)

func (*Checkin) Hits Uses

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

func (*Checkin) IsRunning Uses

func (c *Checkin) IsRunning() bool

IsRunning returns true if the checkin go routine is running

func (*Checkin) LastHit Uses

func (c *Checkin) LastHit() *CheckinHit
func (c *Checkin) Link() string

func (*Checkin) Period Uses

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

func (*Checkin) RecheckCheckinFailure Uses

func (c *Checkin) RecheckCheckinFailure(guard chan struct{})

RecheckCheckinFailure will check if a Service Checkin has been reported yet

func (*Checkin) Start Uses

func (c *Checkin) Start()

Start will create a channel for the checkin checking go routine

func (*Checkin) String Uses

func (c *Checkin) String() string

String will return a Checkin API string

func (*Checkin) Update Uses

func (c *Checkin) Update() error

type CheckinHit Uses

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 Uses

func (c *CheckinHit) Create() error

func (*CheckinHit) Delete Uses

func (c *CheckinHit) Delete() error

func (*CheckinHit) Update Uses

func (c *CheckinHit) Update() error

Package checkins imports 5 packages (graph). Updated 2020-05-26. Refresh now. Tools for package owners.