Documentation ¶
Index ¶
- Variables
- func CheckPutFields(fields field.List) error
- func CheckRenameField(src, dst field.Path) error
- func CompileRegexp(pattern string) (*regexp.Regexp, error)
- func DotExprToField(e Evaluator) (field.Path, error)
- func DotExprToString(e Evaluator) (string, error)
- func EvalBool(zctx *zed.Context, ectx Context, this zed.Value, e Evaluator) (zed.Value, bool)
- func FlattenFields(fields []zed.Field) []zed.Field
- func LookupCompare(typ zed.Type) comparefn
- func NewContext() *allocator
- func SortStable(records []zed.Value, compare CompareFn)
- type Add
- type Aggregator
- type And
- type ArrayExpr
- type Assignment
- type Boolean
- func CompareBool(op string, pattern bool) (Boolean, error)
- func CompareBytes(op string, pattern []byte) (Boolean, error)
- func CompareFloat64(op string, pattern float64) (Boolean, error)
- func CompareIP(op string, pattern netip.Addr) (Boolean, error)
- func CompareInt64(op string, pattern int64) (Boolean, error)
- func CompareNull(op string) (Boolean, error)
- func CompareString(op string, pattern []byte) (Boolean, error)
- func Comparison(op string, val zed.Value) (Boolean, error)
- func Contains(compare Boolean) Boolean
- func NewRegexpBoolean(re *regexp.Regexp) Boolean
- type BufferFilter
- func NewAndBufferFilter(left, right *BufferFilter) *BufferFilter
- func NewBufferFilterForFieldName(pattern string) *BufferFilter
- func NewBufferFilterForString(pattern string) *BufferFilter
- func NewBufferFilterForStringCase(pattern string) *BufferFilter
- func NewOrBufferFilter(left, right *BufferFilter) *BufferFilter
- type Call
- type Comparator
- type Compare
- type CompareFn
- type Conditional
- type ConstShaper
- type Context
- type Cutter
- type Divide
- type DotExpr
- type Dropper
- type Entry
- type Equal
- type Evaluator
- func LookupPrimitiveCaster(zctx *zed.Context, typ zed.Type) Evaluator
- func NewAggregatorExpr(agg *Aggregator) Evaluator
- func NewArithmetic(zctx *zed.Context, lhs, rhs Evaluator, op string) (Evaluator, error)
- func NewDottedExpr(zctx *zed.Context, f field.Path) Evaluator
- func NewFilter(expr Evaluator, pred Boolean) Evaluator
- func NewFilterApplier(zctx *zed.Context, e Evaluator) Evaluator
- func NewIndexExpr(zctx *zed.Context, container, index Evaluator) Evaluator
- func NewMapCall(zctx *zed.Context, e, inner Evaluator) Evaluator
- func NewRecordExpr(zctx *zed.Context, elems []RecordElem) (Evaluator, error)
- func NewSearch(searchtext string, searchval zed.Value, expr Evaluator) (Evaluator, error)
- func NewSearchString(term string, expr Evaluator) Evaluator
- func NewShaper(zctx *zed.Context, expr, typeExpr Evaluator, tf ShaperTransform) (Evaluator, error)
- func SearchByPredicate(pred Boolean, e Evaluator) Evaluator
- type ExprLvalElem
- type FieldNameFinder
- type FieldNameIter
- type Flattener
- type Function
- type In
- type Index
- type Literal
- type Lval
- type LvalElem
- type MapExpr
- type Modulo
- type Multiply
- type Not
- type Or
- type Putter
- type RecordElem
- type RecordSlice
- type RegexpMatch
- type Renamer
- type SetExpr
- type Shaper
- type ShaperTransform
- type Slice
- type StaticLvalElem
- type Subtract
- type This
- type UDF
- type UnaryMinus
- type Var
- type VectorElem
Constants ¶
This section is empty.
Variables ¶
var DivideByZero = errors.New("divide by zero")
var ErrSliceIndex = errors.New("slice index is not a number")
var ErrSliceIndexEmpty = errors.New("slice index is empty")
Functions ¶
func CheckPutFields ¶
func CheckRenameField ¶
func DotExprToString ¶
DotExprToString returns Zed for the Evaluator assuming it's a field expr.
func EvalBool ¶
EvalBool evaluates e with this and if the result is a Zed bool, returns the result and true. Otherwise, a Zed error (inclusive of missing) and false are returned.
func FlattenFields ¶
FlattenFields turns nested records into a series of fields of the form "outer.inner".
func LookupCompare ¶
func NewContext ¶
func NewContext() *allocator
func SortStable ¶
SortStable performs a stable sort on the provided records.
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
func NewAggregator ¶
func NewAggregator(op string, expr Evaluator, where Evaluator) (*Aggregator, error)
func (*Aggregator) NewFunction ¶
func (a *Aggregator) NewFunction() agg.Function
type ArrayExpr ¶
type ArrayExpr struct {
// contains filtered or unexported fields
}
func NewArrayExpr ¶
func NewArrayExpr(zctx *zed.Context, elems []VectorElem) *ArrayExpr
type Assignment ¶
type Boolean ¶
Boolean is a function that takes a Value and returns a boolean result based on the typed value.
func CompareBool ¶
CompareBool returns a Predicate that compares zed.Values to a boolean literal that must be a boolean or coercible to an integer. In the later case, the integer is converted to a boolean.
func CompareFloat64 ¶
CompareFloat64 returns a Predicate that compares typed byte slices that must be coercible to an double with the value's double value using a comparison based on op. Int, count, port, and double types can all be converted to the integer value. XXX there are some overflow issues here.
func CompareIP ¶
Comparison returns a Predicate that compares typed byte slices that must be TypeAddr with the value's address using a comparison based on op. Only equality operands are allowed.
func CompareInt64 ¶
Return a predicate for comparing this value to one more typed byte slices by calling the predicate function with a Value. Operand is one of "==", "!=", "<", "<=", ">", ">=".
func CompareNull ¶
func Comparison ¶
Comparison returns a Predicate for comparing this value to other values. The op argument is one of "==", "!=", "<", "<=", ">", ">=". See the comments of the various type implementations of this method as some types limit the operand to equality and the various types handle coercion in different ways.
func Contains ¶
Given a predicate for comparing individual elements, produce a new predicate that implements the "in" comparison.
func NewRegexpBoolean ¶
NewRegexpBoolean returns a Boolean that compares values that must be a stringy the given regexp.
type BufferFilter ¶
type BufferFilter struct {
// contains filtered or unexported fields
}
BufferFilter is a filter for byte slices containing ZNG values.
func NewAndBufferFilter ¶
func NewAndBufferFilter(left, right *BufferFilter) *BufferFilter
func NewBufferFilterForFieldName ¶
func NewBufferFilterForFieldName(pattern string) *BufferFilter
func NewBufferFilterForString ¶
func NewBufferFilterForString(pattern string) *BufferFilter
func NewBufferFilterForStringCase ¶
func NewBufferFilterForStringCase(pattern string) *BufferFilter
func NewOrBufferFilter ¶
func NewOrBufferFilter(left, right *BufferFilter) *BufferFilter
type Comparator ¶
type Comparator struct {
// contains filtered or unexported fields
}
func NewComparator ¶
func NewComparator(nullsMax, reverse bool, exprs ...Evaluator) *Comparator
NewComparator returns a zed.Value comparator for exprs according to nullsMax and reverse. To compare values a and b, it iterates over the elements e of exprs, stopping when e(a)!=e(b). nullsMax determines whether a null value compares larger (if true) or smaller (if false) than a non-null value. reverse reverses the sense of comparisons.
func (*Comparator) Compare ¶
func (c *Comparator) Compare(a, b zed.Value) int
Compare returns an interger comparing two values according to the receiver's configuration. The result will be 0 if a==b, -1 if a < b, and +1 if a > b.
func (*Comparator) SortStable ¶
func (c *Comparator) SortStable(vals []zed.Value)
SortStable sorts vals according to c, with equal values in their original order. SortStable allocates more memory than [SortStableReader].
func (*Comparator) SortStableReader ¶
func (c *Comparator) SortStableReader(vals []zed.Value) zio.Reader
SortStableReader returns a reader for vals sorted according to c, with equal values in their original order.
func (*Comparator) WithMissingAsNull ¶
func (c *Comparator) WithMissingAsNull() *Comparator
WithMissingAsNull returns the receiver after modifying it to treat missing values as the null value in comparisons.
type Compare ¶
type Compare struct {
// contains filtered or unexported fields
}
func NewCompareRelative ¶
type CompareFn ¶
func NewCompareFn ¶
NewCompareFn creates a function that compares two values a and b according to nullsMax and exprs. To compare a and b, it iterates over the elements e of exprs, stopping when e(a)!=e(b). The handling of missing and null (collectively refered to as "null") values is governed by nullsMax. If nullsMax is true, a null value is considered larger than any non-null value, and vice versa.
type Conditional ¶
type Conditional struct {
// contains filtered or unexported fields
}
func NewConditional ¶
func NewConditional(zctx *zed.Context, predicate, thenExpr, elseExpr Evaluator) *Conditional
type ConstShaper ¶
type ConstShaper struct {
// contains filtered or unexported fields
}
func NewConstShaper ¶
func NewConstShaper(zctx *zed.Context, expr Evaluator, shapeTo zed.Type, tf ShaperTransform) *ConstShaper
NewConstShaper returns a shaper that will shape the result of expr to the provided shapeTo type.
type Context ¶
type Context interface { // Vars() accesses the variables reachable in the current scope. Vars() []zed.Value zed.Allocator }
Context is an interface to a scope and value allocator for expressions. This allows external packages to implement efficient temporary buffering of Zed values both for let-style temporary variables accessible via the scope and for allocating results.
type Cutter ¶
type Cutter struct {
// contains filtered or unexported fields
}
func NewCutter ¶
NewCutter returns a Cutter for fieldnames. If complement is true, the Cutter copies fields that are not in fieldnames. If complement is false, the Cutter copies any fields in fieldnames, where targets specifies the copied field names.
type Equal ¶
type Equal struct {
// contains filtered or unexported fields
}
func NewCompareEquality ¶
type Evaluator ¶
func NewAggregatorExpr ¶
func NewAggregatorExpr(agg *Aggregator) Evaluator
NewAggregatorExpr returns an Evaluator from agg. The returned Evaluator retains the same functionality of the aggregation only it returns it's current state every time a new value is consumed.
func NewArithmetic ¶
NewArithmetic compiles an expression of the form "expr1 op expr2" for the arithmetic operators +, -, *, /
func NewRecordExpr ¶
func NewRecordExpr(zctx *zed.Context, elems []RecordElem) (Evaluator, error)
func NewSearch ¶
NewSearch creates a filter that searches Zed records for the given value, which must be of a type other than string. The filter matches a record that contains this value either as the value of any field or inside any set or array. It also matches a record if the string representaton of the search value appears inside inside any string-valued field (or inside any element of a set or array of strings).
func NewSearchString ¶
NewSearchString is like NewSeach but handles the special case of matching field names in addition to string values.
func NewShaper ¶
NewShaper returns a shaper that will shape the result of expr to the type returned by typeExpr according to tf.
func SearchByPredicate ¶
type ExprLvalElem ¶
type ExprLvalElem struct {
// contains filtered or unexported fields
}
func NewExprLvalElem ¶
func NewExprLvalElem(zctx *zed.Context, e Evaluator) *ExprLvalElem
type FieldNameFinder ¶
type FieldNameFinder struct {
// contains filtered or unexported fields
}
func NewFieldNameFinder ¶
func NewFieldNameFinder(pattern string) *FieldNameFinder
func (*FieldNameFinder) Find ¶
func (f *FieldNameFinder) Find(zctx *zed.Context, buf []byte) bool
Find returns true if buf, which holds a sequence of ZNG value messages, might contain a record with a field whose fully-qualified name (e.g., a.b.c) matches the pattern. Find also returns true if it encounters an error.
type FieldNameIter ¶
type FieldNameIter struct {
// contains filtered or unexported fields
}
func (*FieldNameIter) Done ¶
func (f *FieldNameIter) Done() bool
func (*FieldNameIter) Init ¶
func (f *FieldNameIter) Init(t *zed.TypeRecord)
func (*FieldNameIter) Next ¶
func (f *FieldNameIter) Next() []byte
type Flattener ¶
type Flattener struct {
// contains filtered or unexported fields
}
func NewFlattener ¶
NewFlattener returns a flattener that transforms nested records to flattened records where the type context of the received records must match the zctx parameter provided here. Any new type descriptors that are created to flatten types also use zctx.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index represents an index operator "container[index]" where container is either an array (with index type integer) or a record (with index type string).
type Lval ¶
type Lval struct { Elems []LvalElem // contains filtered or unexported fields }
type Putter ¶
type Putter struct {
// contains filtered or unexported fields
}
Putter is an Evaluator that modifies the record stream with computed values. Each new value is called a clause and consists of a field name and an expression. Each put clause either replaces an existing value in the field specified or appends a value as a new field. Appended values appear as new fields in the order that the clause appears in the put expression.
type RecordElem ¶
type RecordSlice ¶
type RecordSlice struct {
// contains filtered or unexported fields
}
func NewRecordSlice ¶
func NewRecordSlice(compare CompareFn) *RecordSlice
func (*RecordSlice) Index ¶
func (r *RecordSlice) Index(i int) zed.Value
Index returns the ith record.
func (*RecordSlice) Len ¶
func (r *RecordSlice) Len() int
Swap implements sort.Interface for *Record slices.
func (*RecordSlice) Less ¶
func (r *RecordSlice) Less(i, j int) bool
Less implements sort.Interface for *Record slices.
func (*RecordSlice) Pop ¶
func (r *RecordSlice) Pop() interface{}
Pop removes the first element in the array. Implements heap.Interface.
func (*RecordSlice) Push ¶
func (r *RecordSlice) Push(rec interface{})
Push adds x as element Len(). Implements heap.Interface.
func (*RecordSlice) Swap ¶
func (r *RecordSlice) Swap(i, j int)
Swap implements sort.Interface for *Record slices.
type RegexpMatch ¶
type RegexpMatch struct {
// contains filtered or unexported fields
}
func NewRegexpMatch ¶
func NewRegexpMatch(re *regexp.Regexp, e Evaluator) *RegexpMatch
type Renamer ¶
type Renamer struct {
// contains filtered or unexported fields
}
Renamer renames one or more fields in a record. A field can only be renamed within its own record. For example id.orig_h can be renamed to id.src, but it cannot be renamed to src. Renames are applied left to right; each rename observes the effect of all.
type SetExpr ¶
type SetExpr struct {
// contains filtered or unexported fields
}
func NewSetExpr ¶
func NewSetExpr(zctx *zed.Context, elems []VectorElem) *SetExpr
type ShaperTransform ¶
type ShaperTransform int
A ShaperTransform represents one of the different transforms that a shaper can apply. The transforms are represented as bit flags that can be bitwise-ored together to create a single shaping operator that represents the composition of all operators. This composition is efficient as it is created once per incoming type and then the resulting operator is run for every value of that type.
const ( Cast ShaperTransform = 1 << iota Crop Fill Order )
func NewShaperTransform ¶
func NewShaperTransform(s string) ShaperTransform
type StaticLvalElem ¶
type StaticLvalElem struct {
Name string
}
type UnaryMinus ¶
type UnaryMinus struct {
// contains filtered or unexported fields
}
func NewUnaryMinus ¶
func NewUnaryMinus(zctx *zed.Context, e Evaluator) *UnaryMinus