cache

package
v1.0.69 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const AllStatuses = -1

Variables

View Source
var DefaultCacheCount int
View Source
var DefaultWindow string
View Source
var PostgresCache = &postgresCache{}

Functions

func ConvertNamedParams added in v0.38.85

func ConvertNamedParams(sql string, namedArgs map[string]interface{}) (string, []interface{})

func ConvertNamedParamsDebug added in v0.38.85

func ConvertNamedParamsDebug(sql string, namedArgs map[string]interface{}) string

func NewPostgresCache added in v0.38.70

func NewPostgresCache(pool *pgxpool.Pool) *postgresCache

Types

type Cache

type Cache interface {
	Add(check pkg.Check, status ...pkg.CheckStatus)
	GetDetails(checkkey string, time string) interface{}
	RemoveChecks(canary v1.Canary)
	Query(q QueryParams) (pkg.Checks, error)
	QueryStatus(q QueryParams) ([]pkg.Timeseries, error)
	RemoveCheckByKey(key string)
}

type Querier added in v0.38.70

type Querier interface {
	Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)
}

type QueryParams added in v0.38.70

type QueryParams struct {
	Check           string
	CanaryID        string
	Start, End      string
	Window          string
	IncludeMessages bool
	IncludeDetails  bool

	StatusCount    int
	Labels         map[string]string
	Trace          bool
	WindowDuration time.Duration
	// contains filtered or unexported fields
}

func ParseQuery added in v0.38.70

func ParseQuery(c echo.Context) (*QueryParams, error)

func (QueryParams) ExecuteDetails added in v0.38.70

func (q QueryParams) ExecuteDetails(ctx context.Context, db Querier) ([]pkg.Timeseries, error)

func (QueryParams) ExecuteSummary added in v0.38.70

func (q QueryParams) ExecuteSummary(db Querier) (pkg.Checks, error)

func (QueryParams) GetEndTime added in v0.38.70

func (q QueryParams) GetEndTime() *time.Time

func (QueryParams) GetStartTime added in v0.38.70

func (q QueryParams) GetStartTime() *time.Time

func (QueryParams) GetWhereClause added in v0.38.70

func (q QueryParams) GetWhereClause() (string, map[string]interface{}, error)

func (QueryParams) String added in v0.38.70

func (q QueryParams) String() string

func (QueryParams) Validate added in v0.38.70

func (q QueryParams) Validate() error

Jump to

Keyboard shortcuts

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