Documentation ¶
Index ¶
Constants ¶
const ( // CostLevel is the cost for a level access. CostLevel = 10 // CostEvent is the cost for an event access. CostEvent = 100 )
const ( CostTypeAccess = iota CostTypeSize )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnRange ¶
type ColumnRange interface { Contains(v interface{}) bool // Whether this range represents a single value Single() bool MinValue() interface{} }
ColumnRange represents a range of values for a column.
type Constraint ¶
type Constraint struct { Column string `json:"column"` Operator ConstraintOperator `json:"operator"` Value interface{} `json:"value"` }
Constraint represents a constraint for a particular column.
type ConstraintOperator ¶
type ConstraintOperator string
ConstraintOperator represents a constraint operator.
const ( // ConstraintOperatorEquals is an equals operator. ConstraintOperatorEquals ConstraintOperator = "=" // ConstraintOperatorNotEquals is a not equals operator. ConstraintOperatorNotEquals = "!=" )
type ConstraintSet ¶
type ConstraintSet map[string][]Constraint
ConstraintSet is a set of constraints for a number of columns.
func (ConstraintSet) CheckLevel ¶
func (cs ConstraintSet) CheckLevel(level *Level) bool
CheckLevel returns false if the level doesn't meet the constraints in the ConstraintSet.
type Event ¶
type Event map[string]interface{}
Event represents an event.
func (Event) CloneWithout ¶
CloneWithout clones an event without a field.
type FloatColumnRange ¶
FloatColumnRange is a float64 column range.
func (FloatColumnRange) Contains ¶
func (r FloatColumnRange) Contains(v interface{}) bool
Contains returns true if the range may contain v.
func (FloatColumnRange) MinValue ¶
func (r FloatColumnRange) MinValue() interface{}
MinValue returns the min value in the range (inclusive).
func (FloatColumnRange) Single ¶
func (r FloatColumnRange) Single() bool
Single returns true if the range represents a single value.
type IntegerColumnRange ¶
IntegerColumnRange is an int column range.
func (IntegerColumnRange) Contains ¶
func (r IntegerColumnRange) Contains(v interface{}) bool
Contains returns true if the range may contain v.
func (IntegerColumnRange) MinValue ¶
func (r IntegerColumnRange) MinValue() interface{}
MinValue returns the min value in the range (inclusive).
func (IntegerColumnRange) Single ¶
func (r IntegerColumnRange) Single() bool
Single returns true if the range represents a single value.
type JSONColumnRange ¶
type JSONColumnRange struct { Type string `json:"type"` Min interface{} `json:"min"` Max interface{} `json:"max"` }
type Level ¶
type Level struct { // Column this level splits on Column string `json:"column,omitempty"` // Range of values covered by this level Range JSONColumnRange `json:"range,omitempty"` InternalRange ColumnRange `json:"-"` SublevelColumn string `json:"sublevel_column,omitempty"` Sublevels []*Level `json:"sublevels,omitempty"` Events []Event `json:"events,omitempty"` Fixed map[string]interface{} `json:"fixed,omitempty"` Count int `json:"count"` Sums map[string]float64 `json:"sums,omitempty"` }
Level is a Terrace level.
func Generate ¶
func Generate(logger *log.Logger, events []Event, constraints []ConstraintSet, opts Options) (*Level, error)
Generate generates a Level.
func (*Level) Push ¶
func (l *Level) Push(event Event, sublevels []string, columnRanges map[string][]ColumnRange)
Push pushes an event into the level.
type LevelCursor ¶
type LevelCursor struct {
// contains filtered or unexported fields
}
func (*LevelCursor) Err ¶
func (cur *LevelCursor) Err() error
func (*LevelCursor) Next ¶
func (cur *LevelCursor) Next() bool
func (*LevelCursor) Row ¶
func (cur *LevelCursor) Row() query.Row
type StringColumnRange ¶
StringColumnRange is a string column range.
func (StringColumnRange) Contains ¶
func (r StringColumnRange) Contains(v interface{}) bool
Contains returns true if the range may contain v.
func (StringColumnRange) MinValue ¶
func (r StringColumnRange) MinValue() interface{}
MinValue returns the min value in the range (inclusive).
func (StringColumnRange) Single ¶
func (r StringColumnRange) Single() bool
Single returns true if the range represents a single value.