mdbredis

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: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DailyDateFormat is the date format used by the start/end query parameters
	DailyDateFormat  string = "2006-01-02"
	HourlyDateFormat string = "2006-01-02-15"
)
View Source
const (
	Hourly  = time.Hour
	Daily   = 24 * time.Hour
	Weekly  = 7 * Daily
	Monthly = 30 * Daily
	Yearly  = 365 * Daily
)

Variables

View Source
var (
	// NoResolution     = Resolution{"totals", 0, 0, NoResolutionCodec}
	ResolutionHourly = Resolution{"hourly", 0, Hourly, tcodec.LayoutCodec(HourlyDateFormat)}
	ResolutionDaily  = Resolution{"daily", 0, Daily, tcodec.LayoutCodec(DailyDateFormat)}
	ResolutionWeekly = Resolution{"weekly", 0, Weekly, tcodec.ISOWeekCodec}
)

Functions

This section is empty.

Types

type DB

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

func Open

func Open(options Options, events ...string) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) Query

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

func (*DB) Storer

func (db *DB) Storer(event string) meter.Storer

type Options

type Options struct {
	Redis       string
	ScanSize    int64
	KeyPrefix   string
	Resolutions []Resolution
}

func ParseURL

func ParseURL(rawurl string) (o Options, err error)

type Resolution

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

func NewResolution

func NewResolution(name string, step, ttl time.Duration) Resolution

func (Resolution) AddSteps

func (r Resolution) AddSteps(t time.Time, n int) time.Time

func (Resolution) IsZero

func (r Resolution) IsZero() bool

func (Resolution) MarshalTime

func (r Resolution) MarshalTime(t time.Time) string

func (Resolution) Name

func (r Resolution) Name() string

func (Resolution) Step

func (r Resolution) Step() time.Duration

func (Resolution) TTL

func (r Resolution) TTL() time.Duration

func (Resolution) Truncate

func (r Resolution) Truncate(t time.Time) time.Time

func (Resolution) UnmarshalTime

func (r Resolution) UnmarshalTime(s string) (t time.Time, err error)

func (Resolution) WithCodec

func (r Resolution) WithCodec(codec tcodec.TimeCodec) Resolution

func (Resolution) WithLayout

func (r Resolution) WithLayout(layout string) Resolution

func (Resolution) WithName

func (r Resolution) WithName(name string) Resolution

func (Resolution) WithStep

func (r Resolution) WithStep(step time.Duration) Resolution

func (Resolution) WithTTL

func (r Resolution) WithTTL(ttl time.Duration) Resolution

Jump to

Keyboard shortcuts

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