series

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BigIntAgg         = func(scale int) Aggregatable { return &BigIntAggregator{scale: scale} }
	I128Agg      = func(scale int) Aggregatable { return &Int128Aggregator{scale: scale} }
	I256Agg      = func(scale int) Aggregatable { return &Int256Aggregator{scale: scale} }
	BitAgg       = func() Aggregatable { return &BitmapAggregator{} }
	BitAggAnd    = func(src bitmap.Bitmap) Aggregatable { return &BitmapAggregator{src: src, fn: bitmap.And} }
	BitAggOr     = func(src bitmap.Bitmap) Aggregatable { return &BitmapAggregator{src: src, fn: bitmap.Or} }
	BitAggAndNot = func(src bitmap.Bitmap) Aggregatable { return &BitmapAggregator{src: src, fn: bitmap.AndNot} }
)

Exported type templates for use in type maps

View Source
var (
	TimeUnitMinute  = MustParseTimeUnit("m")
	TimeUnitHour    = MustParseTimeUnit("h")
	TimeUnitDay     = MustParseTimeUnit("d")
	TimeUnitWeek    = MustParseTimeUnit("w")
	TimeUnitMonth   = MustParseTimeUnit("M")
	TimeUnitQuarter = MustParseTimeUnit("q")
	TimeUnitYear    = MustParseTimeUnit("y")
)

Functions

func Fill

func Fill[T Number](mode FillMode, now, prev, next time.Time, preval, nextval T) (T, bool, bool)

func WriteBase64Bytes

func WriteBase64Bytes(b *bytes.Buffer, data []byte, sep byte)

func WriteBool

func WriteBool(b *bytes.Buffer, i bool, sep byte)

func WriteFloat64

func WriteFloat64(b *bytes.Buffer, f float64, prec int, sep byte)

func WriteFloat64Slice

func WriteFloat64Slice(b *bytes.Buffer, f []float64, prec int, sep byte)

func WriteHexBytes

func WriteHexBytes(b *bytes.Buffer, data []byte, sep byte)

func WriteInt

func WriteInt(b *bytes.Buffer, i int, sep byte)

func WriteInt64

func WriteInt64(b *bytes.Buffer, i int64, sep byte)

func WriteInt64Slice

func WriteInt64Slice(b *bytes.Buffer, i []int64, sep byte)

func WriteIntSlice

func WriteIntSlice(b *bytes.Buffer, i []int, sep byte)

func WriteNullString

func WriteNullString(b *bytes.Buffer, s string, sep byte)

func WriteRawBytes

func WriteRawBytes(b *bytes.Buffer, data []byte, sep byte)

func WriteRfc3339Slice

func WriteRfc3339Slice(b *bytes.Buffer, t []time.Time, sep byte)

func WriteString

func WriteString(b *bytes.Buffer, s string, sep byte)

func WriteStringSlice

func WriteStringSlice(b *bytes.Buffer, s []string, sep byte)

func WriteUint64

func WriteUint64(b *bytes.Buffer, i uint64, sep byte)

func WriteUint64Slice

func WriteUint64Slice(b *bytes.Buffer, i []uint64, sep byte)

Types

type Aggregatable

type Aggregatable interface {
	encoding.BinaryUnmarshaler
	Emit(*bytes.Buffer) error
	Zero() Aggregatable
	Init(Aggregatable)
	Add(Aggregatable) Aggregatable
	Cmp(Aggregatable) int
	Float64() float64
	SetFloat64(float64)
}

type BitmapAggregator

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

bitmap.Bitmap OR's on add and returns count of bits on emit. When used for linear interpolation or other math, we convert calculated float64 values to a separate internal int counter.

func (*BitmapAggregator) Add

func (BitmapAggregator) Cmp

func (b BitmapAggregator) Cmp(val Aggregatable) int

func (BitmapAggregator) Count

func (b BitmapAggregator) Count() int

func (BitmapAggregator) Emit

func (b BitmapAggregator) Emit(buf *bytes.Buffer) error

func (BitmapAggregator) Float64

func (b BitmapAggregator) Float64() float64

func (*BitmapAggregator) Init

func (b *BitmapAggregator) Init(val Aggregatable)

func (BitmapAggregator) IsZero

func (b BitmapAggregator) IsZero() bool

func (*BitmapAggregator) SetFloat64

func (b *BitmapAggregator) SetFloat64(f64 float64)

func (*BitmapAggregator) UnmarshalBinary

func (b *BitmapAggregator) UnmarshalBinary(src []byte) error

func (BitmapAggregator) Zero

func (b BitmapAggregator) Zero() Aggregatable

type BitmapIntersectFunc

type BitmapIntersectFunc func(bitmap.Bitmap, bitmap.Bitmap) bitmap.Bitmap

type Bucket

type Bucket interface {
	WithDimensions(TimeRange, TimeUnit) Bucket
	WithReducer(ReducerFunc) Bucket
	WithName(string) Bucket
	WithIndex(int) Bucket
	WithFill(FillMode) Bucket
	WithLimit(int) Bucket
	WithType(reflect.Type) Bucket
	WithTypeOf(Aggregatable) Bucket
	WithInit(Aggregatable) Bucket
	Len() int
	Push(time.Time, pack.Row, bool) error
	Emit(*bytes.Buffer) error
}

func NewBucket

func NewBucket(typ pack.FieldType) Bucket

type CountBucket

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

func NewCountBucket

func NewCountBucket() *CountBucket

func (*CountBucket) Emit

func (b *CountBucket) Emit(buf *bytes.Buffer) error

func (*CountBucket) Len

func (b *CountBucket) Len() int

func (*CountBucket) Push

func (b *CountBucket) Push(t time.Time, _ pack.Row, join bool) error

func (*CountBucket) WithDimensions

func (b *CountBucket) WithDimensions(r TimeRange, w TimeUnit) Bucket

func (*CountBucket) WithFill

func (b *CountBucket) WithFill(mode FillMode) Bucket

func (*CountBucket) WithIndex

func (b *CountBucket) WithIndex(index int) Bucket

func (*CountBucket) WithInit

func (b *CountBucket) WithInit(_ Aggregatable) Bucket

func (*CountBucket) WithLimit

func (b *CountBucket) WithLimit(limit int) Bucket

func (*CountBucket) WithName

func (b *CountBucket) WithName(name string) Bucket

func (*CountBucket) WithReducer

func (b *CountBucket) WithReducer(_ ReducerFunc) Bucket

func (*CountBucket) WithType

func (b *CountBucket) WithType(_ reflect.Type) Bucket

func (*CountBucket) WithTypeOf

func (b *CountBucket) WithTypeOf(_ Aggregatable) Bucket

type CountReducer

type CountReducer[T Number] struct {
	// contains filtered or unexported fields
}

COUNT

func (*CountReducer[T]) Reduce

func (r *CountReducer[T]) Reduce(_ T, t time.Time, _ bool)

func (*CountReducer[T]) Reset

func (r *CountReducer[T]) Reset()

func (*CountReducer[T]) Time

func (r *CountReducer[T]) Time() time.Time

func (*CountReducer[T]) Type

func (r *CountReducer[T]) Type() ReducerFunc

func (*CountReducer[T]) Value

func (r *CountReducer[T]) Value() (T, bool)

type Expr

type Expr struct {
	Field  string
	Reduce ReducerFunc
}

type ExprList

type ExprList []Expr

func (*ExprList) AddUnique

func (l *ExprList) AddUnique(name string, fn ReducerFunc)

func (*ExprList) AddUniqueFront

func (l *ExprList) AddUniqueFront(name string, fn ReducerFunc)

func (ExprList) Cols

func (l ExprList) Cols() (cols util.StringList)

func (ExprList) Get

func (s ExprList) Get(i int) (e Expr)

func (ExprList) QueryFields

func (l ExprList) QueryFields() (cols util.StringList)

func (*ExprList) UnmarshalText

func (l *ExprList) UnmarshalText(src []byte) error

type FillMode

type FillMode string
const (
	FillModeInvalid FillMode = ""
	FillModeNone    FillMode = "none"
	FillModeNull    FillMode = "null"
	FillModeLast    FillMode = "last"
	FillModeLinear  FillMode = "linear"
	FillModeZero    FillMode = "zero"
	FillModeNow     FillMode = "now"
)

func ParseFillMode

func ParseFillMode(s string) FillMode

func (FillMode) IsValid

func (m FillMode) IsValid() bool

func (FillMode) MarshalText

func (m FillMode) MarshalText() ([]byte, error)

func (FillMode) String

func (m FillMode) String() string

func (*FillMode) UnmarshalText

func (m *FillMode) UnmarshalText(data []byte) error

type FirstJoinReducer

type FirstJoinReducer[T Number] struct {
	// contains filtered or unexported fields
}

FIRST JOIN

func (*FirstJoinReducer[T]) Reduce

func (r *FirstJoinReducer[T]) Reduce(v T, t time.Time, join bool)

func (*FirstJoinReducer[T]) Reset

func (r *FirstJoinReducer[T]) Reset()

func (*FirstJoinReducer[T]) Time

func (r *FirstJoinReducer[T]) Time() time.Time

func (*FirstJoinReducer[T]) Type

func (r *FirstJoinReducer[T]) Type() ReducerFunc

func (*FirstJoinReducer[T]) Value

func (r *FirstJoinReducer[T]) Value() (T, bool)

type FirstReducer

type FirstReducer[T Number] struct {
	// contains filtered or unexported fields
}

FIRST

func (*FirstReducer[T]) Reduce

func (r *FirstReducer[T]) Reduce(v T, t time.Time, _ bool)

func (*FirstReducer[T]) Reset

func (r *FirstReducer[T]) Reset()

func (*FirstReducer[T]) Time

func (r *FirstReducer[T]) Time() time.Time

func (*FirstReducer[T]) Type

func (r *FirstReducer[T]) Type() ReducerFunc

func (*FirstReducer[T]) Value

func (r *FirstReducer[T]) Value() (T, bool)

type Float

type Float = constraints.Float

type Int128Aggregator

type Int128Aggregator struct {
	vec.Int128
	// contains filtered or unexported fields
}

Int128

func (*Int128Aggregator) Add

func (Int128Aggregator) Cmp

func (b Int128Aggregator) Cmp(val Aggregatable) int

func (Int128Aggregator) Emit

func (b Int128Aggregator) Emit(buf *bytes.Buffer) error

func (Int128Aggregator) Float64

func (b Int128Aggregator) Float64() float64

func (*Int128Aggregator) Init

func (b *Int128Aggregator) Init(val Aggregatable)

func (*Int128Aggregator) SetFloat64

func (b *Int128Aggregator) SetFloat64(f64 float64)

func (*Int128Aggregator) UnmarshalBinary

func (b *Int128Aggregator) UnmarshalBinary(_ []byte) error

func (Int128Aggregator) Zero

func (b Int128Aggregator) Zero() Aggregatable

type Int256Aggregator

type Int256Aggregator struct {
	vec.Int256
	// contains filtered or unexported fields
}

Int256

func (*Int256Aggregator) Add

func (Int256Aggregator) Cmp

func (b Int256Aggregator) Cmp(val Aggregatable) int

func (Int256Aggregator) Emit

func (b Int256Aggregator) Emit(buf *bytes.Buffer) error

func (Int256Aggregator) Float64

func (b Int256Aggregator) Float64() float64

func (*Int256Aggregator) Init

func (b *Int256Aggregator) Init(val Aggregatable)

func (*Int256Aggregator) SetFloat64

func (b *Int256Aggregator) SetFloat64(f64 float64)

func (*Int256Aggregator) UnmarshalBinary

func (b *Int256Aggregator) UnmarshalBinary(_ []byte) error

func (Int256Aggregator) Zero

func (b Int256Aggregator) Zero() Aggregatable

type LastJoinReducer

type LastJoinReducer[T Number] struct {
	// contains filtered or unexported fields
}

LAST JOIN

func (*LastJoinReducer[T]) Reduce

func (r *LastJoinReducer[T]) Reduce(v T, t time.Time, join bool)

func (*LastJoinReducer[T]) Reset

func (r *LastJoinReducer[T]) Reset()

func (*LastJoinReducer[T]) Time

func (r *LastJoinReducer[T]) Time() time.Time

func (*LastJoinReducer[T]) Type

func (r *LastJoinReducer[T]) Type() ReducerFunc

func (*LastJoinReducer[T]) Value

func (r *LastJoinReducer[T]) Value() (T, bool)

type LastReducer

type LastReducer[T Number] struct {
	// contains filtered or unexported fields
}

LAST

func (*LastReducer[T]) Reduce

func (r *LastReducer[T]) Reduce(v T, t time.Time, _ bool)

func (*LastReducer[T]) Reset

func (r *LastReducer[T]) Reset()

func (*LastReducer[T]) Time

func (r *LastReducer[T]) Time() time.Time

func (*LastReducer[T]) Type

func (r *LastReducer[T]) Type() ReducerFunc

func (*LastReducer[T]) Value

func (r *LastReducer[T]) Value() (T, bool)

type LimitableRequest

type LimitableRequest interface {
	ApplyLimits(int, int)
}

type MaxJoinReducer

type MaxJoinReducer[T Number] struct {
	// contains filtered or unexported fields
}

MAX JOIN

func (*MaxJoinReducer[T]) Reduce

func (r *MaxJoinReducer[T]) Reduce(v T, t time.Time, join bool)

func (*MaxJoinReducer[T]) Reset

func (r *MaxJoinReducer[T]) Reset()

func (*MaxJoinReducer[T]) Time

func (r *MaxJoinReducer[T]) Time() time.Time

func (*MaxJoinReducer[T]) Type

func (r *MaxJoinReducer[T]) Type() ReducerFunc

func (*MaxJoinReducer[T]) Value

func (r *MaxJoinReducer[T]) Value() (T, bool)

type MaxReducer

type MaxReducer[T Number] struct {
	// contains filtered or unexported fields
}

MAX

func (*MaxReducer[T]) Reduce

func (r *MaxReducer[T]) Reduce(v T, t time.Time, _ bool)

func (*MaxReducer[T]) Reset

func (r *MaxReducer[T]) Reset()

func (*MaxReducer[T]) Time

func (r *MaxReducer[T]) Time() time.Time

func (*MaxReducer[T]) Type

func (r *MaxReducer[T]) Type() ReducerFunc

func (*MaxReducer[T]) Value

func (r *MaxReducer[T]) Value() (T, bool)

type MeanJoinReducer

type MeanJoinReducer[T Number] struct {
	// contains filtered or unexported fields
}

MEAN JOIN Welford's Online algorithm, see https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance

func (*MeanJoinReducer[T]) Reduce

func (r *MeanJoinReducer[T]) Reduce(v T, t time.Time, join bool)

func (*MeanJoinReducer[T]) Reset

func (r *MeanJoinReducer[T]) Reset()

func (*MeanJoinReducer[T]) Time

func (r *MeanJoinReducer[T]) Time() time.Time

func (*MeanJoinReducer[T]) Type

func (r *MeanJoinReducer[T]) Type() ReducerFunc

func (*MeanJoinReducer[T]) Value

func (r *MeanJoinReducer[T]) Value() (T, bool)

type MeanReducer

type MeanReducer[T Number] struct {
	// contains filtered or unexported fields
}

MEAN Welford's Online algorithm, see https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance

func (*MeanReducer[T]) Reduce

func (r *MeanReducer[T]) Reduce(v T, t time.Time, _ bool)

func (*MeanReducer[T]) Reset

func (r *MeanReducer[T]) Reset()

func (*MeanReducer[T]) Time

func (r *MeanReducer[T]) Time() time.Time

func (*MeanReducer[T]) Type

func (r *MeanReducer[T]) Type() ReducerFunc

func (*MeanReducer[T]) Value

func (r *MeanReducer[T]) Value() (T, bool)

type MinJoinReducer

type MinJoinReducer[T Number] struct {
	// contains filtered or unexported fields
}

MIN JOIN

func (*MinJoinReducer[T]) Reduce

func (r *MinJoinReducer[T]) Reduce(v T, t time.Time, join bool)

func (*MinJoinReducer[T]) Reset

func (r *MinJoinReducer[T]) Reset()

func (*MinJoinReducer[T]) Time

func (r *MinJoinReducer[T]) Time() time.Time

func (*MinJoinReducer[T]) Type

func (r *MinJoinReducer[T]) Type() ReducerFunc

func (*MinJoinReducer[T]) Value

func (r *MinJoinReducer[T]) Value() (T, bool)

type MinReducer

type MinReducer[T Number] struct {
	// contains filtered or unexported fields
}

MIN

func (*MinReducer[T]) Reduce

func (r *MinReducer[T]) Reduce(v T, t time.Time, _ bool)

func (*MinReducer[T]) Reset

func (r *MinReducer[T]) Reset()

func (*MinReducer[T]) Time

func (r *MinReducer[T]) Time() time.Time

func (*MinReducer[T]) Type

func (r *MinReducer[T]) Type() ReducerFunc

func (*MinReducer[T]) Value

func (r *MinReducer[T]) Value() (T, bool)

type NativeBucket

type NativeBucket[T Number] struct {
	// contains filtered or unexported fields
}

func NewNativeBucket

func NewNativeBucket[T Number]() *NativeBucket[T]

func (*NativeBucket[T]) Emit

func (b *NativeBucket[T]) Emit(buf *bytes.Buffer) error

func (*NativeBucket[T]) Len

func (b *NativeBucket[T]) Len() int

func (*NativeBucket[T]) Push

func (b *NativeBucket[T]) Push(t time.Time, r pack.Row, join bool) error

func (*NativeBucket[T]) WithDimensions

func (b *NativeBucket[T]) WithDimensions(r TimeRange, w TimeUnit) Bucket

func (*NativeBucket[T]) WithFill

func (b *NativeBucket[T]) WithFill(mode FillMode) Bucket

func (*NativeBucket[T]) WithIndex

func (b *NativeBucket[T]) WithIndex(index int) Bucket

func (*NativeBucket[T]) WithInit

func (b *NativeBucket[T]) WithInit(_ Aggregatable) Bucket

func (*NativeBucket[T]) WithLimit

func (b *NativeBucket[T]) WithLimit(limit int) Bucket

func (*NativeBucket[T]) WithName

func (b *NativeBucket[T]) WithName(name string) Bucket

func (*NativeBucket[T]) WithReducer

func (b *NativeBucket[T]) WithReducer(fn ReducerFunc) Bucket

func (*NativeBucket[T]) WithType

func (b *NativeBucket[T]) WithType(_ reflect.Type) Bucket

func (*NativeBucket[T]) WithTypeOf

func (b *NativeBucket[T]) WithTypeOf(_ Aggregatable) Bucket

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

type Reducer

type Reducer[T Number] interface {
	Reduce(T, time.Time, bool)
	Reset()
	Value() (T, bool)
	Time() time.Time
	Type() ReducerFunc
}

func NewReducer

func NewReducer[T Number](fn ReducerFunc) Reducer[T]

type ReducerFunc

type ReducerFunc string
const (
	ReducerFuncInvalid ReducerFunc = ""
	ReducerFuncSum     ReducerFunc = "sum"
	ReducerFuncFirst   ReducerFunc = "first"
	ReducerFuncLast    ReducerFunc = "last"
	ReducerFuncMin     ReducerFunc = "min"
	ReducerFuncMax     ReducerFunc = "max"
	ReducerFuncMean    ReducerFunc = "mean"
	ReducerFuncVar     ReducerFunc = "var"
	ReducerFuncStd     ReducerFunc = "std"
	ReducerFuncCount   ReducerFunc = "count"

	// sum same timestamp items, then apply reducer
	ReducerFuncFirstJoin ReducerFunc = "first_join"
	ReducerFuncLastJoin  ReducerFunc = "last_join"
	ReducerFuncMinJoin   ReducerFunc = "min_join"
	ReducerFuncMaxJoin   ReducerFunc = "max_join"
	ReducerFuncMeanJoin  ReducerFunc = "mean_join"
	ReducerFuncVarJoin   ReducerFunc = "var_join"
	ReducerFuncStdJoin   ReducerFunc = "std_join"
)

func ParseReducerFunc

func ParseReducerFunc(s string) ReducerFunc

func (ReducerFunc) IsValid

func (f ReducerFunc) IsValid() bool

func (ReducerFunc) MarshalText

func (f ReducerFunc) MarshalText() ([]byte, error)

func (ReducerFunc) String

func (f ReducerFunc) String() string

func (*ReducerFunc) UnmarshalText

func (f *ReducerFunc) UnmarshalText(data []byte) error

type Request

type Request struct {
	Select   ExprList  `form:"select"`
	Range    TimeRange `form:"range,default=M"`
	Interval TimeUnit  `form:"interval,default=d"`
	Fill     FillMode  `form:"fill,default=none"`
	Limit    int       `form:"limit,default=100"`
	GroupBy  string    `form:"group_by"`
	Table    string    `form:"table"`
	TypeMap  TypeMap
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest() *Request

func (*Request) ApplyLimits

func (r *Request) ApplyLimits(def, max int) *Request

func (Request) MakeBucket

func (r Request) MakeBucket(expr Expr, tinfo pack.FieldList) (Bucket, error)

func (Request) Query

func (r Request) Query(key string) pack.Query

func (Request) Run

func (r Request) Run(ctx context.Context, key string) (*Result, error)

func (Request) RunQuery

func (req Request) RunQuery(ctx context.Context, q pack.Query) (*Result, error)

func (*Request) Sanitize

func (r *Request) Sanitize() *Request

func (*Request) WithExpr

func (r *Request) WithExpr(field string, fn ReducerFunc) *Request

func (*Request) WithFill

func (r *Request) WithFill(m FillMode) *Request

func (*Request) WithGroupBy

func (r *Request) WithGroupBy(g string) *Request

func (*Request) WithInterval

func (r *Request) WithInterval(u TimeUnit) *Request

func (*Request) WithLimit

func (r *Request) WithLimit(l int) *Request

func (*Request) WithRange

func (r *Request) WithRange(rng TimeRange) *Request

func (*Request) WithTable

func (r *Request) WithTable(t pack.Table) *Request

func (*Request) WithType

func (r *Request) WithType(name string, agg Aggregatable) *Request

type Result

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

func (Result) Columns

func (r Result) Columns() []string

func (Result) Groups

func (r Result) Groups() []string

func (Result) MarshalJSON

func (r Result) MarshalJSON() ([]byte, error)

output series from all buckets

{"series": [{
   "name": "",
   "tags":{"entity":"quipu"} // <-- group
   "columns": [""],
   "values": [[...],[...]]
}]

type Signed

type Signed = constraints.Signed

type StdJoinReducer

type StdJoinReducer[T Number] struct {
	// contains filtered or unexported fields
}

STD JOIN

func (*StdJoinReducer[T]) Reduce

func (r *StdJoinReducer[T]) Reduce(v T, t time.Time, join bool)

func (*StdJoinReducer[T]) Reset

func (r *StdJoinReducer[T]) Reset()

func (*StdJoinReducer[T]) Time

func (r *StdJoinReducer[T]) Time() time.Time

func (*StdJoinReducer[T]) Type

func (r *StdJoinReducer[T]) Type() ReducerFunc

func (*StdJoinReducer[T]) Value

func (r *StdJoinReducer[T]) Value() (T, bool)

type StdReducer

type StdReducer[T Number] struct {
	// contains filtered or unexported fields
}

STD

func (*StdReducer[T]) Reduce

func (r *StdReducer[T]) Reduce(v T, t time.Time, _ bool)

func (*StdReducer[T]) Reset

func (r *StdReducer[T]) Reset()

func (*StdReducer[T]) Time

func (r *StdReducer[T]) Time() time.Time

func (*StdReducer[T]) Type

func (r *StdReducer[T]) Type() ReducerFunc

func (*StdReducer[T]) Value

func (r *StdReducer[T]) Value() (T, bool)

type SumReducer

type SumReducer[T Number] struct {
	// contains filtered or unexported fields
}

SUM

func (*SumReducer[T]) Reduce

func (r *SumReducer[T]) Reduce(v T, t time.Time, _ bool)

func (*SumReducer[T]) Reset

func (r *SumReducer[T]) Reset()

func (*SumReducer[T]) Time

func (r *SumReducer[T]) Time() time.Time

func (*SumReducer[T]) Type

func (r *SumReducer[T]) Type() ReducerFunc

func (*SumReducer[T]) Value

func (r *SumReducer[T]) Value() (T, bool)

type TimeBucket

type TimeBucket struct {
	NativeBucket[int64]
}

func NewTimeBucket

func NewTimeBucket() *TimeBucket

type TimeRange

type TimeRange struct {
	Key        string // custom, ytd, 3m
	From       time.Time
	To         time.Time
	IsRelative bool
}

func MustParseTimeRange

func MustParseTimeRange(s string) TimeRange

func NewTimeRangeSince

func NewTimeRangeSince(u TimeUnit) TimeRange

func ParseTimeRange

func ParseTimeRange(s string) (TimeRange, error)

func (TimeRange) Duration

func (r TimeRange) Duration() time.Duration

func (TimeRange) Epochs

func (r TimeRange) Epochs(interval TimeUnit, limit int) (epochs [][2]time.Time)

func (TimeRange) MarshalText

func (r TimeRange) MarshalText() ([]byte, error)

func (TimeRange) NumSteps

func (r TimeRange) NumSteps(u TimeUnit) (steps int)

func (TimeRange) Sanitize

func (r TimeRange) Sanitize(now time.Time) TimeRange

func (*TimeRange) Set

func (r *TimeRange) Set(s string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (TimeRange) String

func (r TimeRange) String() string

func (TimeRange) Truncate

func (r TimeRange) Truncate(d time.Duration) TimeRange

func (*TimeRange) UnmarshalText

func (r *TimeRange) UnmarshalText(data []byte) error

type TimeUnit

type TimeUnit struct {
	Value int
	Unit  rune
}

func MustParseTimeUnit

func MustParseTimeUnit(s string) TimeUnit

func ParseTimeUnit

func ParseTimeUnit(s string) (TimeUnit, error)

func (TimeUnit) Add

func (c TimeUnit) Add(t time.Time) time.Time

func (TimeUnit) Base

func (c TimeUnit) Base() time.Duration

func (TimeUnit) Between

func (c TimeUnit) Between(from, to time.Time, limit int) []time.Time

func (TimeUnit) Duration

func (c TimeUnit) Duration() time.Duration

func (TimeUnit) Format

func (c TimeUnit) Format(t time.Time) string

func (TimeUnit) MarshalText

func (c TimeUnit) MarshalText() ([]byte, error)

func (TimeUnit) Next

func (c TimeUnit) Next(t time.Time, n int) time.Time

func (*TimeUnit) Set

func (u *TimeUnit) Set(s string) (err error)

Set implements the flags.Value interface for use in command line argument parsing.

func (TimeUnit) Steps

func (c TimeUnit) Steps(from, to time.Time, limit int) []time.Time

func (TimeUnit) String

func (c TimeUnit) String() string

func (TimeUnit) Sub

func (c TimeUnit) Sub(t time.Time) time.Time

func (TimeUnit) Title

func (c TimeUnit) Title() string

func (TimeUnit) Truncate

func (c TimeUnit) Truncate(t time.Time) time.Time

Truncate truncates t to time unit, e.g. - minutes: full minute - hours: full hour - days: midnight UTC - weeks: midnight UTC on first day of week (Sunday) - months: midnight UTC on first day of month - quarters: midnight UTC on first day of quarter - years: midnight UTC on first day of year

func (TimeUnit) TruncateRelative

func (c TimeUnit) TruncateRelative(t time.Time, base time.Time) time.Time

TruncateRelative takes the unit's value into account and truncates t relative to base.

func (*TimeUnit) UnmarshalText

func (c *TimeUnit) UnmarshalText(data []byte) error

type TypeMap

type TypeMap map[string]Aggregatable

type TypedBucket

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

func NewTypedBucket

func NewTypedBucket() *TypedBucket

func (*TypedBucket) Emit

func (b *TypedBucket) Emit(buf *bytes.Buffer) error

func (*TypedBucket) Len

func (b *TypedBucket) Len() int

func (*TypedBucket) Push

func (b *TypedBucket) Push(t time.Time, r pack.Row, join bool) error

func (*TypedBucket) WithDimensions

func (b *TypedBucket) WithDimensions(r TimeRange, w TimeUnit) Bucket

func (*TypedBucket) WithFill

func (b *TypedBucket) WithFill(mode FillMode) Bucket

func (*TypedBucket) WithIndex

func (b *TypedBucket) WithIndex(index int) Bucket

func (*TypedBucket) WithInit

func (b *TypedBucket) WithInit(val Aggregatable) Bucket

func (*TypedBucket) WithLimit

func (b *TypedBucket) WithLimit(limit int) Bucket

func (*TypedBucket) WithName

func (b *TypedBucket) WithName(name string) Bucket

func (*TypedBucket) WithReducer

func (b *TypedBucket) WithReducer(fn ReducerFunc) Bucket

func (*TypedBucket) WithType

func (b *TypedBucket) WithType(typ reflect.Type) Bucket

func (*TypedBucket) WithTypeOf

func (b *TypedBucket) WithTypeOf(val Aggregatable) Bucket

type TypedFirstJoinReducer

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

FIRST JOIN

func (*TypedFirstJoinReducer) Config

func (r *TypedFirstJoinReducer) Config() Aggregatable

func (*TypedFirstJoinReducer) Init

func (*TypedFirstJoinReducer) Reduce

func (r *TypedFirstJoinReducer) Reduce(v Aggregatable, t time.Time, join bool)

func (*TypedFirstJoinReducer) Reset

func (r *TypedFirstJoinReducer) Reset()

func (*TypedFirstJoinReducer) Time

func (r *TypedFirstJoinReducer) Time() time.Time

func (*TypedFirstJoinReducer) Type

func (*TypedFirstJoinReducer) Value

func (r *TypedFirstJoinReducer) Value() (Aggregatable, bool)

type TypedFirstReducer

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

FIRST

func (*TypedFirstReducer) Config

func (r *TypedFirstReducer) Config() Aggregatable

func (*TypedFirstReducer) Init

func (r *TypedFirstReducer) Init(v Aggregatable)

func (*TypedFirstReducer) Reduce

func (r *TypedFirstReducer) Reduce(v Aggregatable, t time.Time, _ bool)

func (*TypedFirstReducer) Reset

func (r *TypedFirstReducer) Reset()

func (*TypedFirstReducer) Time

func (r *TypedFirstReducer) Time() time.Time

func (*TypedFirstReducer) Type

func (r *TypedFirstReducer) Type() ReducerFunc

func (*TypedFirstReducer) Value

func (r *TypedFirstReducer) Value() (Aggregatable, bool)

type TypedLastJoinReducer

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

LAST JOIN

func (*TypedLastJoinReducer) Config

func (r *TypedLastJoinReducer) Config() Aggregatable

func (*TypedLastJoinReducer) Init

func (*TypedLastJoinReducer) Reduce

func (r *TypedLastJoinReducer) Reduce(v Aggregatable, t time.Time, join bool)

func (*TypedLastJoinReducer) Reset

func (r *TypedLastJoinReducer) Reset()

func (*TypedLastJoinReducer) Time

func (r *TypedLastJoinReducer) Time() time.Time

func (*TypedLastJoinReducer) Type

func (*TypedLastJoinReducer) Value

func (r *TypedLastJoinReducer) Value() (Aggregatable, bool)

type TypedLastReducer

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

LAST

func (*TypedLastReducer) Config

func (r *TypedLastReducer) Config() Aggregatable

func (*TypedLastReducer) Init

func (r *TypedLastReducer) Init(v Aggregatable)

func (*TypedLastReducer) Reduce

func (r *TypedLastReducer) Reduce(v Aggregatable, t time.Time, _ bool)

func (*TypedLastReducer) Reset

func (r *TypedLastReducer) Reset()

func (*TypedLastReducer) Time

func (r *TypedLastReducer) Time() time.Time

func (*TypedLastReducer) Type

func (r *TypedLastReducer) Type() ReducerFunc

func (*TypedLastReducer) Value

func (r *TypedLastReducer) Value() (Aggregatable, bool)

type TypedMaxJoinReducer

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

MAX JOIN

func (*TypedMaxJoinReducer) Config

func (r *TypedMaxJoinReducer) Config() Aggregatable

func (*TypedMaxJoinReducer) Init

func (r *TypedMaxJoinReducer) Init(v Aggregatable)

func (*TypedMaxJoinReducer) Reduce

func (r *TypedMaxJoinReducer) Reduce(v Aggregatable, t time.Time, join bool)

func (*TypedMaxJoinReducer) Reset

func (r *TypedMaxJoinReducer) Reset()

func (*TypedMaxJoinReducer) Time

func (r *TypedMaxJoinReducer) Time() time.Time

func (*TypedMaxJoinReducer) Type

func (r *TypedMaxJoinReducer) Type() ReducerFunc

func (*TypedMaxJoinReducer) Value

func (r *TypedMaxJoinReducer) Value() (Aggregatable, bool)

type TypedMaxReducer

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

MAX

func (*TypedMaxReducer) Config

func (r *TypedMaxReducer) Config() Aggregatable

func (*TypedMaxReducer) Init

func (r *TypedMaxReducer) Init(v Aggregatable)

func (*TypedMaxReducer) Reduce

func (r *TypedMaxReducer) Reduce(v Aggregatable, t time.Time, _ bool)

func (*TypedMaxReducer) Reset

func (r *TypedMaxReducer) Reset()

func (*TypedMaxReducer) Time

func (r *TypedMaxReducer) Time() time.Time

func (*TypedMaxReducer) Type

func (r *TypedMaxReducer) Type() ReducerFunc

func (*TypedMaxReducer) Value

func (r *TypedMaxReducer) Value() (Aggregatable, bool)

type TypedMeanJoinReducer

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

MEAN JOIN Welford's Online algorithm, see https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance

func (*TypedMeanJoinReducer) Config

func (r *TypedMeanJoinReducer) Config() Aggregatable

func (*TypedMeanJoinReducer) Init

func (*TypedMeanJoinReducer) Reduce

func (r *TypedMeanJoinReducer) Reduce(v Aggregatable, t time.Time, join bool)

func (*TypedMeanJoinReducer) Reset

func (r *TypedMeanJoinReducer) Reset()

func (*TypedMeanJoinReducer) Time

func (r *TypedMeanJoinReducer) Time() time.Time

func (*TypedMeanJoinReducer) Type

func (*TypedMeanJoinReducer) Value

func (r *TypedMeanJoinReducer) Value() (Aggregatable, bool)

type TypedMeanReducer

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

MEAN Welford's Online algorithm, see https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance

func (*TypedMeanReducer) Config

func (r *TypedMeanReducer) Config() Aggregatable

func (*TypedMeanReducer) Init

func (r *TypedMeanReducer) Init(v Aggregatable)

func (*TypedMeanReducer) Reduce

func (r *TypedMeanReducer) Reduce(v Aggregatable, t time.Time, _ bool)

func (*TypedMeanReducer) Reset

func (r *TypedMeanReducer) Reset()

func (*TypedMeanReducer) Time

func (r *TypedMeanReducer) Time() time.Time

func (*TypedMeanReducer) Type

func (r *TypedMeanReducer) Type() ReducerFunc

func (*TypedMeanReducer) Value

func (r *TypedMeanReducer) Value() (Aggregatable, bool)

type TypedMinJoinReducer

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

MIN JOIN

func (*TypedMinJoinReducer) Config

func (r *TypedMinJoinReducer) Config() Aggregatable

func (*TypedMinJoinReducer) Init

func (r *TypedMinJoinReducer) Init(v Aggregatable)

func (*TypedMinJoinReducer) Reduce

func (r *TypedMinJoinReducer) Reduce(v Aggregatable, t time.Time, join bool)

func (*TypedMinJoinReducer) Reset

func (r *TypedMinJoinReducer) Reset()

func (*TypedMinJoinReducer) Time

func (r *TypedMinJoinReducer) Time() time.Time

func (*TypedMinJoinReducer) Type

func (r *TypedMinJoinReducer) Type() ReducerFunc

func (*TypedMinJoinReducer) Value

func (r *TypedMinJoinReducer) Value() (Aggregatable, bool)

type TypedMinReducer

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

MIN

func (*TypedMinReducer) Config

func (r *TypedMinReducer) Config() Aggregatable

func (*TypedMinReducer) Init

func (r *TypedMinReducer) Init(v Aggregatable)

func (*TypedMinReducer) Reduce

func (r *TypedMinReducer) Reduce(v Aggregatable, t time.Time, _ bool)

func (*TypedMinReducer) Reset

func (r *TypedMinReducer) Reset()

func (*TypedMinReducer) Time

func (r *TypedMinReducer) Time() time.Time

func (*TypedMinReducer) Type

func (r *TypedMinReducer) Type() ReducerFunc

func (*TypedMinReducer) Value

func (r *TypedMinReducer) Value() (Aggregatable, bool)

type TypedReducer

type TypedReducer interface {
	Reduce(Aggregatable, time.Time, bool)
	Reset()
	Init(Aggregatable)
	Value() (Aggregatable, bool)
	Config() Aggregatable
	Time() time.Time
	Type() ReducerFunc
}

func NewTypedReducer

func NewTypedReducer(typ reflect.Type, fn ReducerFunc) TypedReducer

type TypedStdJoinReducer

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

STD JOIN

func (*TypedStdJoinReducer) Config

func (r *TypedStdJoinReducer) Config() Aggregatable

func (*TypedStdJoinReducer) Init

func (r *TypedStdJoinReducer) Init(v Aggregatable)

func (*TypedStdJoinReducer) Reduce

func (r *TypedStdJoinReducer) Reduce(v Aggregatable, t time.Time, join bool)

func (*TypedStdJoinReducer) Reset

func (r *TypedStdJoinReducer) Reset()

func (*TypedStdJoinReducer) Time

func (r *TypedStdJoinReducer) Time() time.Time

func (*TypedStdJoinReducer) Type

func (r *TypedStdJoinReducer) Type() ReducerFunc

func (*TypedStdJoinReducer) Value

func (r *TypedStdJoinReducer) Value() (Aggregatable, bool)

type TypedStdReducer

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

STD

func (*TypedStdReducer) Config

func (r *TypedStdReducer) Config() Aggregatable

func (*TypedStdReducer) Init

func (r *TypedStdReducer) Init(v Aggregatable)

func (*TypedStdReducer) Reduce

func (r *TypedStdReducer) Reduce(v Aggregatable, t time.Time, _ bool)

func (*TypedStdReducer) Reset

func (r *TypedStdReducer) Reset()

func (*TypedStdReducer) Time

func (r *TypedStdReducer) Time() time.Time

func (*TypedStdReducer) Type

func (r *TypedStdReducer) Type() ReducerFunc

func (*TypedStdReducer) Value

func (r *TypedStdReducer) Value() (Aggregatable, bool)

type TypedSumReducer

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

SUM

func (*TypedSumReducer) Config

func (r *TypedSumReducer) Config() Aggregatable

func (*TypedSumReducer) Init

func (r *TypedSumReducer) Init(v Aggregatable)

func (*TypedSumReducer) Reduce

func (r *TypedSumReducer) Reduce(v Aggregatable, t time.Time, _ bool)

func (*TypedSumReducer) Reset

func (r *TypedSumReducer) Reset()

func (*TypedSumReducer) Time

func (r *TypedSumReducer) Time() time.Time

func (*TypedSumReducer) Type

func (r *TypedSumReducer) Type() ReducerFunc

func (*TypedSumReducer) Value

func (r *TypedSumReducer) Value() (Aggregatable, bool)

type TypedVarJoinReducer

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

VAR JOIN

func (*TypedVarJoinReducer) Config

func (r *TypedVarJoinReducer) Config() Aggregatable

func (*TypedVarJoinReducer) Init

func (r *TypedVarJoinReducer) Init(v Aggregatable)

func (*TypedVarJoinReducer) Reduce

func (r *TypedVarJoinReducer) Reduce(v Aggregatable, t time.Time, join bool)

func (*TypedVarJoinReducer) Reset

func (r *TypedVarJoinReducer) Reset()

func (*TypedVarJoinReducer) Time

func (r *TypedVarJoinReducer) Time() time.Time

func (*TypedVarJoinReducer) Type

func (r *TypedVarJoinReducer) Type() ReducerFunc

func (*TypedVarJoinReducer) Value

func (r *TypedVarJoinReducer) Value() (Aggregatable, bool)

type TypedVarReducer

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

VAR

func (*TypedVarReducer) Config

func (r *TypedVarReducer) Config() Aggregatable

func (*TypedVarReducer) Init

func (r *TypedVarReducer) Init(v Aggregatable)

func (*TypedVarReducer) Reduce

func (r *TypedVarReducer) Reduce(v Aggregatable, t time.Time, _ bool)

func (*TypedVarReducer) Reset

func (r *TypedVarReducer) Reset()

func (*TypedVarReducer) Time

func (r *TypedVarReducer) Time() time.Time

func (*TypedVarReducer) Type

func (r *TypedVarReducer) Type() ReducerFunc

func (*TypedVarReducer) Value

func (r *TypedVarReducer) Value() (Aggregatable, bool)

type Unsigned

type Unsigned = constraints.Unsigned

type VarJoinReducer

type VarJoinReducer[T Number] struct {
	// contains filtered or unexported fields
}

VAR JOIN

func (*VarJoinReducer[T]) Reduce

func (r *VarJoinReducer[T]) Reduce(v T, t time.Time, join bool)

func (*VarJoinReducer[T]) Reset

func (r *VarJoinReducer[T]) Reset()

func (*VarJoinReducer[T]) Time

func (r *VarJoinReducer[T]) Time() time.Time

func (*VarJoinReducer[T]) Type

func (r *VarJoinReducer[T]) Type() ReducerFunc

func (*VarJoinReducer[T]) Value

func (r *VarJoinReducer[T]) Value() (T, bool)

type VarReducer

type VarReducer[T Number] struct {
	// contains filtered or unexported fields
}

VAR

func (*VarReducer[T]) Reduce

func (r *VarReducer[T]) Reduce(v T, t time.Time, _ bool)

func (*VarReducer[T]) Reset

func (r *VarReducer[T]) Reset()

func (*VarReducer[T]) Time

func (r *VarReducer[T]) Time() time.Time

func (*VarReducer[T]) Type

func (r *VarReducer[T]) Type() ReducerFunc

func (*VarReducer[T]) Value

func (r *VarReducer[T]) Value() (T, bool)

Jump to

Keyboard shortcuts

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