mdbhttp

package
v2.0.0-beta9 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB(baseURL string, client HTTPClient, events ...string) (meter.DB, error)

DB connects to a remote meter.DB over HTTP

func Handler

func Handler(db meter.DB, events ...string) http.HandlerFunc

Handler creates an HTTP endpoint for a meter.DB

func InflateRequest

func InflateRequest(next http.Handler) http.HandlerFunc

InflateRequest middleware inflates request body

func ParseQuery

func ParseQuery(values url.Values) (q meter.Query, err error)

ParseQuery sets query values from a URL query

func ParseTime

func ParseTime(v string) (time.Time, error)

func QueryHandler

func QueryHandler(querier meter.Querier) http.HandlerFunc

QueryHandler returns an HTTP endpoint for a QueryRunner

func QueryValues

func QueryValues(q *meter.Query) url.Values

func StoreHandler

func StoreHandler(s meter.Storer) http.HandlerFunc

StoreHandler returns an HTTP endpoint for an EventStore

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient does HTTP requests

type Querier

type Querier struct {
	URL string
	HTTPClient
}

Querier runs queries over http

func (*Querier) Eval

func (qr *Querier) Eval(ctx context.Context, q *meter.Query, exp ...string) (meter.Results, error)

Eval implements meter.Evaler interface

func (*Querier) Query

func (qr *Querier) Query(ctx context.Context, q meter.Query, events ...string) (meter.Results, error)

Query implements Querier interface

type Storer

type Storer struct {
	HTTPClient
	URL string
}

Storer is a remote Storer over HTTP

func (*Storer) Store

func (c *Storer) Store(r *meter.Snapshot) (err error)

Store implements EventStore interface

Jump to

Keyboard shortcuts

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