evutil

package
v0.1.0-beta9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenResults

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

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 AutoStore

type AutoStore struct {
	New func(event string) db.Storer
	// contains filtered or unexported fields
}

AutoStore is a Store that creates a new Storer if it is not Registered

func (*AutoStore) Storer

func (a *AutoStore) Storer(event string) (w db.Storer)

Storer implements Store interface

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)

FieldSummaries 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.ScanQuery) (db.Results, error)

Scan implements the Scanner interface

func (MemoryStore) Storer

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

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 EventStore interface

type MuxScanner

type MuxScanner map[string]db.ScanQuerier

MuxScanner multiplexes ScanQuerier instances into a Scanner

func (MuxScanner) Scan

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

Scan implements Scanner

func (MuxScanner) Set

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

Set assigns a ScanQuerier instance to some events

type MuxStore

type MuxStore map[string]db.Storer

MuxStore maps event names to Storers

func (MuxStore) Add

func (m MuxStore) Add(event string, s db.Storer) (MuxStore, db.Storer)

Add set an additional Storer for an event

func (MuxStore) Set

func (m MuxStore) Set(event string, s db.Storer) MuxStore

Set sets a Storer for an event

func (MuxStore) Storer

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

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 SyncStore

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

SyncStore provides a mutable Store safe for concurrent use

func (*SyncStore) Add

func (s *SyncStore) Add(event string, w db.Storer) db.Storer

Add sets an additional Storer for an event

func (*SyncStore) Register

func (s *SyncStore) Register(event string, w db.Storer) bool

Register sets the Storer if none exists

func (*SyncStore) Set

func (s *SyncStore) Set(event string, w db.Storer)

Set sets the Storer for an event

func (*SyncStore) Storer

func (s *SyncStore) Storer(event string) (w db.Storer)

Storer implements Store 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"`
}

type Totals

type Totals []Total

func NewTotals

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

Totals returns a totals-only Results slice

Jump to

Keyboard shortcuts

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