sql

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFilePathNotSpecified is the error returned when path parameter passed in NewStore is blank
	ErrFilePathNotSpecified = errors.New("file path cannot be empty")

	// ErrDatabaseDriverNotSpecified is the error returned when the driver parameter passed in NewStore is blank
	ErrDatabaseDriverNotSpecified = errors.New("database driver cannot be empty")
)

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store that leverages a database

func NewStore

func NewStore(driver, path string) (*Store, error)

NewStore initializes the database and creates the schema if it doesn't already exist in the file specified

func (*Store) Clear

func (s *Store) Clear()

Clear deletes everything from the store

func (*Store) Close

func (s *Store) Close()

Close the database handle

func (*Store) DeleteAllServiceStatusesNotInKeys

func (s *Store) DeleteAllServiceStatusesNotInKeys(keys []string) int

DeleteAllServiceStatusesNotInKeys removes all rows owned by a service whose key is not within the keys provided

func (*Store) GetAllServiceStatuses

func (s *Store) GetAllServiceStatuses(params *paging.ServiceStatusParams) ([]*core.ServiceStatus, error)

GetAllServiceStatuses returns all monitored core.ServiceStatus with a subset of core.Result defined by the page and pageSize parameters

func (*Store) GetAverageResponseTimeByKey

func (s *Store) GetAverageResponseTimeByKey(key string, from, to time.Time) (int, error)

GetAverageResponseTimeByKey returns the average response time in milliseconds (value) during a time range

func (*Store) GetHourlyAverageResponseTimeByKey

func (s *Store) GetHourlyAverageResponseTimeByKey(key string, from, to time.Time) (map[int64]int, error)

GetHourlyAverageResponseTimeByKey returns a map of hourly (key) average response time in milliseconds (value) during a time range

func (*Store) GetServiceStatus

func (s *Store) GetServiceStatus(groupName, serviceName string, params *paging.ServiceStatusParams) (*core.ServiceStatus, error)

GetServiceStatus returns the service status for a given service name in the given group

func (*Store) GetServiceStatusByKey

func (s *Store) GetServiceStatusByKey(key string, params *paging.ServiceStatusParams) (*core.ServiceStatus, error)

GetServiceStatusByKey returns the service status for a given key

func (*Store) GetUptimeByKey

func (s *Store) GetUptimeByKey(key string, from, to time.Time) (float64, error)

GetUptimeByKey returns the uptime percentage during a time range

func (*Store) Insert

func (s *Store) Insert(service *core.Service, result *core.Result) error

Insert adds the observed result for the specified service into the store

func (*Store) Save

func (s *Store) Save() error

Save does nothing, because this store is immediately persistent.

Jump to

Keyboard shortcuts

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