Documentation ¶
Overview ¶
Package static provides utilities for easily constructing static tables that are meant for tests.
The primary type is Table which will be a mapping of columns to their data. The data is defined in a columnar format instead of a row-based one.
The implementations in this package are not performant and are not meant to be used in production code. They are good enough for small datasets that are present in tests to ensure code correctness.
Index ¶
- type Column
- func BooleanKey(v interface{}) Column
- func Booleans(v ...interface{}) Column
- func FloatKey(v interface{}) Column
- func Floats(v ...interface{}) Column
- func IntKey(v interface{}) Column
- func Ints(v ...interface{}) Column
- func StringKey(v interface{}) Column
- func Strings(v ...interface{}) Column
- func TimeKey(v interface{}) Column
- func Times(v ...interface{}) Column
- func UintKey(v interface{}) Column
- func Uints(v ...interface{}) Column
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column interface { // Type returns the column type for this column. Type() flux.ColType // Make will construct an array with the given length // if it is possible. Make(n int) array.Interface // Len will return the length of this column. // If no length is known, this will return -1. Len() int // IsKey will return true if this is part of the group key. IsKey() bool // KeyValue will return the key value if this column is part // of the group key. KeyValue() values.Value }
Column is the definition for how to construct a column for the table.
func BooleanKey ¶
func BooleanKey(v interface{}) Column
BooleanKey will construct a group key with the boolean type. The value can be a bool or nil.
func Booleans ¶
func Booleans(v ...interface{}) Column
Booleans will construct an array of booleans. Each value can be a bool or nil.
func FloatKey ¶
func FloatKey(v interface{}) Column
FloatKey will construct a group key with the float type. The value can be a float64, int, int64, or nil.
func Floats ¶
func Floats(v ...interface{}) Column
Floats will construct an array of floats. Each value can be a float64, int, int64, or nil.
func IntKey ¶
func IntKey(v interface{}) Column
IntKey will construct a group key with the integer type. The value can be an int, int64, or nil.
func Ints ¶
func Ints(v ...interface{}) Column
Ints will construct an array of integers. Each value can be an int, int64, or nil.
func StringKey ¶
func StringKey(v interface{}) Column
StringKey will construct a group key with the string type. The value can be a string or nil.
func Strings ¶
func Strings(v ...interface{}) Column
Strings will construct an array of strings. Each value can be a string or nil.
func TimeKey ¶
func TimeKey(v interface{}) Column
TimeKey will construct a group key with the given time using either a string or an integer. If an integer is used, then it is in seconds.
func Times ¶
func Times(v ...interface{}) Column
Times will construct an array of times with the given time using either a string or an integer. If an integer is used, then it is in seconds.
If strings and integers are mixed, the integers will be treates as offsets from the last string time that was used.