core

package
v0.0.0-...-df46cc1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HavingFieldName is the name of the synthetic field for the HAVING clause.
	HavingFieldName = "_having"
)

Variables

View Source
var (
	// ErrDeadlineExceeded indicates that the deadline for iterating has been
	// exceeded. Results may be incomplete.
	ErrDeadlineExceeded = errors.New("deadline exceeded")

	// PointsField is the synthetic field that counts number of submitted points.
	PointsField = NewField("_points", expr.SUM("_point"))
)
View Source
var (
	// ClusterCrosstab is the crosstab expression for crosstabs that come from an
	// contained Group By (i.e. from a cluster follower)
	ClusterCrosstab = goexpr.Param("_crosstab")
)

Functions

func FieldsIgnored

func FieldsIgnored(fields Fields) error

FieldsIgnored is a placeholder for an OnFields that does nothing.

func FormatSource

func FormatSource(source Source) string

Types

type CombinedFieldSource

type CombinedFieldSource []FieldSource

CombinedFieldSource is a FieldSource that combines multiple FieldSources and ensures that a field is not repeated.

func (CombinedFieldSource) Get

func (cfs CombinedFieldSource) Get(known Fields) (Fields, error)

func (CombinedFieldSource) String

func (cfs CombinedFieldSource) String() string

type ExprFieldSource

type ExprFieldSource struct {
	Name string
	Expr ExprSource
}

ExprFieldSource turns an ExprSource into a FieldSource with a single named field.

func (ExprFieldSource) Get

func (efs ExprFieldSource) Get(known Fields) (Fields, error)

func (ExprFieldSource) String

func (efs ExprFieldSource) String() string

type ExprSource

type ExprSource interface {
	Get(known Fields) (expr.Expr, error)

	String() string
}

ExprSource is a source of an expression based on some known Fields.

type Field

type Field struct {
	Expr expr.Expr
	Name string
}

Field is a named expr.Expr

func NewField

func NewField(name string, ex expr.Expr) Field

NewField is a convenience method for creating new Fields.

func (Field) Equals

func (f Field) Equals(o Field) bool

func (Field) String

func (f Field) String() string

type FieldSource

type FieldSource interface {
	Get(known Fields) (Fields, error)

	String() string
}

FieldSource is a source of Fields based on some known Fields.

var PassthroughFieldSource FieldSource = passthroughFieldSource{}

PassthroughFieldSource simply passes through the known Fields.

type Fields

type Fields []Field

func (Fields) Equals

func (fields Fields) Equals(o Fields) bool

func (Fields) Exprs

func (fields Fields) Exprs() []expr.Expr

func (Fields) Names

func (fields Fields) Names() []string

type FlatRow

type FlatRow struct {
	TS  int64
	Key bytemap.ByteMap
	// Values for each field
	Values []float64
	// contains filtered or unexported fields
}

func (*FlatRow) Get

func (row *FlatRow) Get(param string) interface{}

Get implements the interface method from goexpr.Params

func (*FlatRow) SetFields

func (row *FlatRow) SetFields(fields Fields)

type FlatRowSource

type FlatRowSource interface {
	Source
	Iterate(ctx context.Context, onFields OnFields, onRow OnFlatRow) (metadata interface{}, err error)
}

func FlatRowFilter

func FlatRowFilter(source FlatRowSource, label string, include func(ctx context.Context, row *FlatRow, fields Fields) (*FlatRow, error)) FlatRowSource

func Flatten

func Flatten(source RowSource) FlatRowSource

func Limit

func Limit(source FlatRowSource, lim int) FlatRowSource

func Offset

func Offset(source FlatRowSource, off int) FlatRowSource

func Sort

func Sort(source FlatRowSource, by ...OrderBy) FlatRowSource

type GroupBy

type GroupBy struct {
	Expr goexpr.Expr
	Name string
}

GroupBy is a named goexpr.Expr.

func NewGroupBy

func NewGroupBy(name string, ex goexpr.Expr) GroupBy

NewGroupBy is a convenience method for creating new GroupBys.

func (GroupBy) String

func (g GroupBy) String() string

type GroupOpts

type GroupOpts struct {
	By                    []GroupBy
	Crosstab              goexpr.Expr
	CrosstabIncludesTotal bool
	Fields                FieldSource
	Resolution            time.Duration
	AsOf                  time.Time
	Until                 time.Time
	StrideSlice           time.Duration
}

type OnFields

type OnFields func(fields Fields) error

type OnFlatRow

type OnFlatRow func(flatRow *FlatRow) (bool, error)

type OnRow

type OnRow func(key bytemap.ByteMap, vals Vals) (bool, error)

type OrderBy

type OrderBy struct {
	Field      string
	Descending bool
}

OrderBy specifies an element by whith to order (element being ither a field name or the name of a dimension in the row key).

func NewOrderBy

func NewOrderBy(field string, descending bool) OrderBy

func (OrderBy) String

func (o OrderBy) String() string

type RowSource

type RowSource interface {
	Source
	Iterate(ctx context.Context, onFields OnFields, onRow OnRow) (metadata interface{}, err error)
}

func Group

func Group(source RowSource, opts GroupOpts) RowSource

func RowFilter

func RowFilter(source RowSource, label string, include func(ctx context.Context, key bytemap.ByteMap, fields Fields, vals Vals) (bytemap.ByteMap, Vals, error)) RowSource

func Unflatten

func Unflatten(source FlatRowSource, fields FieldSource) RowSource

func UnflattenOptimized

func UnflattenOptimized(source FlatRowSource) RowSource

type Source

type Source interface {
	GetGroupBy() []GroupBy

	GetResolution() time.Duration

	GetAsOf() time.Time

	GetUntil() time.Time

	String() string
}

type StaticFieldSource

type StaticFieldSource Fields

StaticFieldSource is a FieldSource that always returns the same Fields.

func (StaticFieldSource) Get

func (sfs StaticFieldSource) Get(known Fields) (Fields, error)

func (StaticFieldSource) String

func (sfs StaticFieldSource) String() string

type TimeoutGuard

type TimeoutGuard interface {
	// TimedOut returns true if the context deadline has been exceeded.
	TimedOut() bool

	// Proceed returns false, ErrDeadlineExceeded if the context deadline has been
	// exceeded
	Proceed() (more bool, err error)

	// ProceedAfter returns origMore, origErr if origMore is false or origErr is
	// not nil, else behaves like Proceed()
	ProceedAfter(origMore bool, origErr error) (more bool, err error)
}

TimeoutGuard provides the ability to guard against timeouts on a Context.

func Guard

func Guard(ctx context.Context) TimeoutGuard

Guard creates a new TimeoutGuard for the given Context.

type Transform

type Transform interface {
	GetSource() Source
}

type Vals

type Vals []encoding.Sequence

Jump to

Keyboard shortcuts

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