postgres

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "postgres"

Type should match the package name

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	DSN string `json:"dsn"`

	// Issue create statements for database schema
	Create bool `json:"create"`

	// Check files older than CheckExpiry will be
	// deleted on calls to Maintain(). If this is
	// the zero value, no old check files will be
	// deleted.
	CheckExpiry time.Duration `json:"check_expiry,omitempty"`
}

Storage is a way to store checkup results in a PostgreSQL database.

func New

func New(config json.RawMessage) (Storage, error)

New creates a new Storage instance based on json config

func (Storage) Fetch

func (opts Storage) Fetch(name string) ([]types.Result, error)

Fetch fetches results of the check with given name.

func (Storage) GetIndex

func (opts Storage) GetIndex() (map[string]int64, error)

GetIndex returns the list of check results for the database.

func (Storage) Maintain

func (opts Storage) Maintain() error

Maintain deletes check files that are older than opts.CheckExpiry.

func (Storage) Store

func (opts Storage) Store(results []types.Result) error

Store stores results in the database.

func (Storage) Type

func (Storage) Type() string

Type returns the storage driver package name

Jump to

Keyboard shortcuts

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