Documentation
¶
Index ¶
- Variables
- func CompileRegexp(pattern string) (*regexp.Regexp, error)
- func DotExprToField(e Evaluator) (field.Path, error)
- func DotExprToString(e Evaluator) (string, error)
- func FlattenColumns(cols []zed.Column) []zed.Column
- func LookupCompare(typ zed.Type) comparefn
- func SortStable(records []zed.Value, compare CompareFn)
- type Add
- type AggExpr
- type Aggregator
- type And
- type ArrayExpr
- type Assignment
- type Boolean
- func CompareBool(op string, pattern bool) (Boolean, error)
- func CompareBstring(op string, pattern []byte) (Boolean, error)
- func CompareBytes(op string, pattern []byte) (Boolean, error)
- func CompareFloat64(op string, pattern float64) (Boolean, error)
- func CompareIP(op string, pattern net.IP) (Boolean, error)
- func CompareInt64(op string, pattern int64) (Boolean, error)
- func CompareSubnet(op string, pattern *net.IPNet) (Boolean, error)
- func CompareTime(op string, pattern int64) (Boolean, error)
- func CompareUnset(op string) (Boolean, error)
- func Comparison(op string, primitive astzed.Primitive) (Boolean, error)
- func Contains(compare Boolean) Boolean
- func NewRegexpBoolean(re *regexp.Regexp) Boolean
- type BufferFilter
- func NewAndBufferFilter(left, right *BufferFilter) *BufferFilter
- func NewBufferFilterForString(pattern string) *BufferFilter
- func NewBufferFilterForStringCase(pattern string) *BufferFilter
- func NewFieldNameFinder(pattern string) *BufferFilter
- func NewOrBufferFilter(left, right *BufferFilter) *BufferFilter
- type Call
- type Compare
- type CompareFn
- type Conditional
- type ConstShaper
- type Cutter
- type Divide
- type DotExpr
- type Dropper
- type Entry
- type Equal
- type Evaluator
- type Filter
- func Apply(e Evaluator, pred Boolean) Filter
- func EvalAny(eval Boolean, recursive bool) Filter
- func LogicalAnd(left, right Filter) Filter
- func LogicalNot(expr Filter) Filter
- func LogicalOr(left, right Filter) Filter
- func SearchRecordOther(searchtext string, searchval astzed.Primitive) (Filter, error)
- func SearchRecordString(term string) Filter
- type FilterEvaluator
- type FilterMethod
- type Flattener
- type Generator
- type Has
- type In
- type Index
- type KeyCompareFn
- type Literal
- type MapExpr
- type MapMethod
- type Missing
- type Multiply
- type Not
- type Or
- type PrimitiveCaster
- type RecordExpr
- type RecordSlice
- type RegexpMatch
- type RootRecord
- type Selector
- type SetExpr
- type Shaper
- type ShaperTransform
- type Slice
- type Subtract
- type TypeFunc
- type Unflattener
- type ValueCompareFn
- type Var
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadValue = errors.New("bad value") ErrFieldRequired = errors.New("field parameter required") )
var ErrBadCast = errors.New("bad cast")
var ErrIncompatibleTypes = coerce.ErrIncompatibleTypes
var ErrIndexOutOfBounds = errors.New("array index out of bounds")
var ErrNotContainer = errors.New("cannot apply in to a non-container")
var ErrSliceIndex = errors.New("slice index is not a number")
var ErrSliceIndexEmpty = errors.New("slice index is empty")
Functions ¶
func DotExprToString ¶
DotExprToString returns Zed for the Evaluator assuming it's a field expr.
func FlattenColumns ¶
FlattenColumns turns nested records into a series of columns of the form "outer.inner".
func LookupCompare ¶
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 Filter) (*Aggregator, error)
func (*Aggregator) NewFunction ¶
func (a *Aggregator) NewFunction() agg.Function
type Assignment ¶
type Boolean ¶
Predicate 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 CompareSubnet ¶
Comparison returns a Predicate that compares typed byte slices that must be an addr or a subnet to the value's subnet value using a comparison based on op. Onluy equalty and inequality are permitted. If the typed byte slice is a subnet, then the comparison is based on strict equality. If the typed byte slice is an addr, then the comparison is performed by doing a CIDR match on the address with the subnet.
func CompareUnset ¶
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. The new predicate looks at the type of the value being compared, if it is a set or array, the original predicate is applied to each element. The new precicate returns true iff the predicate matched an element from the collection.
func NewRegexpBoolean ¶
NewRegexpBoolean returns a Booelan 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 NewBufferFilterForString ¶
func NewBufferFilterForString(pattern string) *BufferFilter
func NewBufferFilterForStringCase ¶
func NewBufferFilterForStringCase(pattern string) *BufferFilter
func NewFieldNameFinder ¶
func NewFieldNameFinder(pattern string) *BufferFilter
func NewOrBufferFilter ¶
func NewOrBufferFilter(left, right *BufferFilter) *BufferFilter
type Compare ¶
type Compare struct {
// contains filtered or unexported fields
}
func NewCompareRelative ¶
type CompareFn ¶
func NewCompareFn ¶
NewCompareFn creates a function that compares a pair of Records based on the provided ordered list of fields. The returned function uses the same return conventions as standard routines such as bytes.Compare() and strings.Compare(), so it may be used with packages such as heap and sort. The handling of records in which a comparison field is unset or not present (collectively refered to as fields in which the value is "null") is governed by the nullsMax parameter. If this parameter is true, a record with a null value is considered larger than a record with any other value, and vice versa.
type Conditional ¶
type Conditional struct {
// contains filtered or unexported fields
}
func NewConditional ¶
func NewConditional(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 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.
func (*Cutter) AllowPartialCuts ¶
func (c *Cutter) AllowPartialCuts()
type DotExpr ¶
type DotExpr struct {
// contains filtered or unexported fields
}
func NewDotAccess ¶
type Dropper ¶
type Dropper struct {
// contains filtered or unexported fields
}
type Equal ¶
type Equal struct {
// contains filtered or unexported fields
}
func NewCompareEquality ¶
type Evaluator ¶
func NewArithmetic ¶
NewArithmetic compiles an expression of the form "expr1 op expr2" for the arithmetic operators +, -, *, /
func NewDotExpr ¶
func NewIndexExpr ¶
func NewRootField ¶
type Filter ¶
func LogicalAnd ¶
func LogicalNot ¶
func SearchRecordOther ¶
SearchRecordOther creates a filter that searches zng records for the given value, which must be of a type other than (b)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 SearchRecordString ¶
SearchRecordString handles the special case of string searching -- it matches both field names and values.
type FilterEvaluator ¶
type FilterEvaluator Filter
type FilterMethod ¶
type FilterMethod struct {
// contains filtered or unexported fields
}
func NewFilterMethod ¶
func NewFilterMethod(src Generator) *FilterMethod
func (*FilterMethod) Init ¶
func (f *FilterMethod) Init(rec *zed.Value)
func (*FilterMethod) Ref ¶
func (f *FilterMethod) Ref() *zed.Value
func (*FilterMethod) Set ¶
func (f *FilterMethod) Set(e Evaluator)
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 Has ¶
type Has struct {
// contains filtered or unexported fields
}
https://github.com/brimdata/zed/blob/main/docs/language/functions.md#has
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 KeyCompareFn ¶
func NewKeyCompareFn ¶
func NewKeyCompareFn(key *zed.Value) (KeyCompareFn, error)
type MapMethod ¶
type MapMethod struct {
// contains filtered or unexported fields
}
func NewMapMethod ¶
type Missing ¶
type Missing struct {
// contains filtered or unexported fields
}
https://github.com/brimdata/zed/blob/main/docs/language/functions.md#missing
func NewMissing ¶
type PrimitiveCaster ¶
func LookupPrimitiveCaster ¶
func LookupPrimitiveCaster(typ zed.Type) PrimitiveCaster
type RecordExpr ¶
type RecordExpr struct {
// contains filtered or unexported fields
}
func NewRecordExpr ¶
func NewRecordExpr(zctx *zed.Context, names []string, exprs []Evaluator) *RecordExpr
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 RootRecord ¶
type RootRecord struct{}
type Selector ¶
type Selector struct {
// contains filtered or unexported fields
}
func NewSelector ¶
type Shaper ¶
type Shaper struct {
// contains filtered or unexported fields
}
type ShaperTransform ¶
type ShaperTransform int
A ShaperTransform represents one of the different transforms that a shaper can apply. The transforms are represented as a 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 carried once per incoming type signature and then the resulting operator is run for every value of that type.
const ( Cast ShaperTransform = 1 << iota Fill Crop Order )
type TypeFunc ¶
type TypeFunc struct {
// contains filtered or unexported fields
}
A TyepFunc returns a type value of the named type (where the name is a Zed typedef). It returns MISSING if the name doesn't exist.
type Unflattener ¶
type Unflattener struct {
// contains filtered or unexported fields
}
func NewUnflattener ¶
func NewUnflattener(zctx *zed.Context) *Unflattener
NewUnflattener returns a Unflattener that turns successive dotted field names into nested records. For example, unflattening {"a.a": 1, "a.b": 1} results in {a:{a:1,b:1}}. Note that while unflattening is applied recursively from the top-level and applies to arbitrary-depth dotted names, it is not applied to dotted names that start at lower levels (for example {a:{"a.a":1}} is unchanged).
type ValueCompareFn ¶
func NewValueCompareFn ¶
func NewValueCompareFn(nullsMax bool) ValueCompareFn