Documentation ¶
Index ¶
- type Tabulator
- func (t *Tabulator) Accumulate()
- func (t *Tabulator) Add(timestamp time.Time, column string, value float64) bool
- func (t *Tabulator) Copy() *Tabulator
- func (t *Tabulator) Filter(from, to time.Time)
- func (t *Tabulator) GetColumns() []string
- func (t *Tabulator) GetTimestamps() []time.Time
- func (t *Tabulator) GetValues(columnName string) ([]float64, bool)
- func (t *Tabulator) MarshalJSON() ([]byte, error)
- func (t *Tabulator) RegisterColumn(column ...string)
- func (t *Tabulator) SaveBinary() ([]byte, error)
- func (t *Tabulator) Set(timestamp time.Time, column string, value float64) bool
- func (t *Tabulator) Size() int
- func (t *Tabulator) UnmarshalJSON(bytes []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tabulator ¶
type Tabulator struct { Timestamps indexer[time.Time] Columns indexer[string] Data [][]float64 // contains filtered or unexported fields }
Tabulator tabulates a set of entries in rows by timestamp and columns by label. For performance reasons, Data must be added sequentially.
func (*Tabulator) Accumulate ¶
func (t *Tabulator) Accumulate()
Accumulate increments the values in each column.
func (*Tabulator) Add ¶
Add adds a value for a specified timestamp and column to the table. If there is already a value for that timestamp and column, the specified value is added to the existing value.
Returns false if the column does not exist. Use RegisterColumn to add it first.
func (*Tabulator) Filter ¶
Filter removes all rows that do not fall inside the specified time range. If the specified time is zero, it will be ignored.
func (*Tabulator) GetColumns ¶
GetColumns returns the (sorted) list of column names.
func (*Tabulator) GetTimestamps ¶
GetTimestamps returns the (sorted) list of timestamps in the table.
func (*Tabulator) GetValues ¶
GetValues returns the value for the specified column for each timestamp in the table. The values are sorted by timestamp.
func (*Tabulator) MarshalJSON ¶ added in v0.3.0
func (*Tabulator) RegisterColumn ¶
RegisterColumn adds the specified columns to the table.
func (*Tabulator) SaveBinary ¶ added in v0.3.0
func (*Tabulator) Set ¶
Set sets the value for a specified timestamp and column to the table.
Returns false if the column does not exist. Use RegisterColumn to add it first.