evutil

package
v0.1.0-beta20 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheStore

func CacheStore(s db.Store) db.Store

CacheStore caches Storers from a Store

func FlattenResults

func FlattenResults(multi ...db.Results) (flat db.Results)

FlattenResults concatenates results to a single slice

func FormatResults

func FormatResults(format string, rows ...db.Results) (interface{}, bool)

FormatResults convers results to requested format

func TeeStore

func TeeStore(stores ...db.Storer) db.Storer

TeeStore stores to multiple stores

func ZipFields

func ZipFields(labels []string, values []string) (fields db.Fields)

ZipFields creates a field collection zipping labels and values

Types

type EventSummaries

type EventSummaries struct {
	Labels []string
	Events []string
	Data   []EventSummary
}

EventSummaries is a result summary format

func NewEventSummaries

func NewEventSummaries(empty string, results db.Results) *EventSummaries

NewEventSummaries groups results as EventSummaries

func (*EventSummaries) Table

func (s *EventSummaries) Table() Table

Table returns event summaries as a table

type EventSummary

type EventSummary struct {
	Values []string
	Totals map[string]float64
}

EventSummary groups values with totals

func (*EventSummary) TableRow

func (r *EventSummary) TableRow(events []string) []interface{}

TableRow is a helper to convert event summary to table

type FieldCache

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

FieldCache is an in memory cache of field ids

func (*FieldCache) BlobID

func (c *FieldCache) BlobID(blob []byte) (id uint64, ok bool)

BlobID returns the id of raw fields

func (*FieldCache) Fields

func (c *FieldCache) Fields(id uint64) (fields db.Fields)

Fields gets fields by id

func (*FieldCache) ID

func (c *FieldCache) ID(fields db.Fields) (uint64, bool)

ID gets the id of fields

func (*FieldCache) Labels

func (c *FieldCache) Labels() (labels []string)

Labels returns the distinct cached labels

func (*FieldCache) Set

func (c *FieldCache) Set(id uint64, fields db.Fields) db.Fields

Set set a field to an id

func (*FieldCache) SetBlob

func (c *FieldCache) SetBlob(id uint64, blob []byte) db.Fields

SetBlob sets a raw field value to an id

type FieldSummaries

type FieldSummaries []FieldSummary

FieldSummaries is a slice of FieldSummary results

func NewFieldSummaries

func NewFieldSummaries(results db.Results) (s FieldSummaries)

NewFieldSummaries converts a series of results to a slice of FieldSummary results

type FieldSummary

type FieldSummary struct {
	Event  string             `json:"event"`
	Label  string             `json:"label"`
	Values map[string]float64 `json:"values"`
}

FieldSummary is a query result presented as a summary of field values

func (*FieldSummary) Add

func (s *FieldSummary) Add(value string, n float64)

Add ads a value to a field summary

type MemoryStore

type MemoryStore map[string]*MemoryStorer

MemoryStore is a Store collecting snapshots in memory

func NewMemoryStore

func NewMemoryStore(events ...string) MemoryStore

NewMemoryStore creates a new MemoryStore

func (MemoryStore) Scan

func (m MemoryStore) Scan(ctx context.Context, queries ...db.Query) (db.Results, error)

Scan implements the Scanner interface

func (MemoryStore) Storer

func (m MemoryStore) Storer(event string) (db.Storer, error)

Storer implements Store interface

type MemoryStorer

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

MemoryStorer is an in-memory EventStore for debugging

func (*MemoryStorer) Last

func (m *MemoryStorer) Last() *db.Snapshot

Last retuns the last posted StoreRequest

func (*MemoryStorer) Len

func (m *MemoryStorer) Len() int

Len retuns the number of stored snapshots

func (*MemoryStorer) Store

func (m *MemoryStorer) Store(s *db.Snapshot) error

Store implements Storer interface

type MuxScanner

type MuxScanner map[string]db.Querier

MuxScanner multiplexes Querier instances into a Scanner

func (MuxScanner) Scan

func (m MuxScanner) Scan(ctx context.Context, queries ...db.Query) (db.Results, error)

Scan implements Scanner

func (MuxScanner) Set

func (m MuxScanner) Set(s db.Querier, events ...string) MuxScanner

Set assigns a Querier instance to some events

type MuxStore

type MuxStore map[string]db.Store

MuxStore maps event names to Store

func (MuxStore) Register

func (m MuxStore) Register(s db.Store, events ...string) MuxStore

Register registers a store for some events

func (MuxStore) Storer

func (m MuxStore) Storer(event string) (db.Storer, error)

Storer implements Store interface

type StorerFunc

type StorerFunc func(s *db.Snapshot) error

StorerFunc is a function that implements Storer interface

func (StorerFunc) Store

func (fn StorerFunc) Store(s *db.Snapshot) error

Store implements Storer interface

type Table

type Table struct {
	Columns []interface{}   `json:"cols"`
	Data    [][]interface{} `json:"data"`
}

Table holds generic tabular data

type Total

type Total struct {
	Event  string    `json:"event"`
	Fields db.Fields `json:"fields,omitempty"`
	Total  float64   `json:"total"`
}

Total is a scalar value result

type Totals

type Totals []Total

Totals is a slice of Total

func NewTotals

func NewTotals(results db.Results) (totals Totals)

NewTotals returns a totals-only Results slice

Jump to

Keyboard shortcuts

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