evhttp

package
v0.1.0-beta1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMux

func DefaultMux(db evdb.DB, events ...string) http.Handler

DefaultMux creates an HTTP endpoint for a evdb.DB

func EncodeScanQuery

func EncodeScanQuery(values url.Values, q *evdb.ScanQuery) error

func EncodeTimeRange

func EncodeTimeRange(values url.Values, q evdb.TimeRange)

func InflateRequest

func InflateRequest(next http.Handler) http.HandlerFunc

InflateRequest middleware inflates request body

func MatchFieldsFromURL

func MatchFieldsFromURL(values url.Values) (m evdb.MatchFields, err error)

func ParseTime

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

ParseTime parses time in various formats

func QueryHandler

func QueryHandler(scanner evdb.Scanner) http.HandlerFunc

QueryHandler returns an HTTP endpoint for a QueryRunner

func ScanQueryFromURL

func ScanQueryFromURL(values url.Values) (q evdb.ScanQuery, err error)

ScanQueryFromURL parses a ScanQuery from a URL query

func ScanQueryHandler

func ScanQueryHandler(scan evdb.Scanner) http.HandlerFunc

func ScanURL

func ScanURL(baseURL string, q *evdb.ScanQuery) (string, error)

func StoreHandler

func StoreHandler(s meter.Storer) http.HandlerFunc

StoreHandler returns an HTTP endpoint for an EventStore

func TimeRangeFromURL

func TimeRangeFromURL(values url.Values) (t evdb.TimeRange, err error)

func TimeRangeURL

func TimeRangeURL(rawURL string, t *evdb.TimeRange) (string, error)

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) Query

func (qr *Querier) Query(ctx context.Context, r evdb.TimeRange, q string) ([]interface{}, error)

Query implements evdb.Evaler interface

type ScanQuerier

type ScanQuerier struct {
	URL string
	HTTPClient
}

ScanQuerier runs scan queries over http

func (*ScanQuerier) ScanQuery

func (s *ScanQuerier) ScanQuery(ctx context.Context, q *evdb.ScanQuery) (evdb.Results, error)

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