Documentation ¶
Overview ¶
Package ast declares the types used to represent syntax trees for Zed queries.
Index ¶
- type Agg
- type ArrayExpr
- type Assert
- type Assignment
- type Assignments
- type BinaryExpr
- type Call
- type Case
- type Cast
- type Conditional
- type ConstDecl
- type Cut
- type Debug
- type Decl
- type Def
- type Drop
- type EntryExpr
- type Explode
- type Expr
- type FString
- type FStringElem
- type FStringExpr
- type FStringText
- type Field
- type File
- type From
- type FuncDecl
- type Fuse
- type Glob
- type Grep
- type HTTP
- type Head
- type ID
- type IndexExpr
- type Join
- type Load
- type MapExpr
- type Merge
- type Node
- type Op
- type OpAssignment
- type OpDecl
- type OpExpr
- type Output
- type Over
- type OverExpr
- type Parallel
- type Pass
- type Pattern
- type Pool
- type PoolSpec
- type Put
- type QuotedString
- type RecordElem
- type RecordExpr
- type Regexp
- type Rename
- type Sample
- type Scope
- type Search
- type Seq
- type SetExpr
- type Shape
- type SliceExpr
- type Sort
- type SortExpr
- type Source
- type Spread
- type String
- type Summarize
- type Switch
- type Tail
- type Term
- type Top
- type Trunk
- type TypeDecl
- type UnaryExpr
- type Uniq
- type VectorElem
- type VectorValue
- type Where
- type Yield
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agg ¶
type Agg struct { Kind string `json:"kind" unpack:""` Name string `json:"name"` NamePos int `json:"name_pos"` Expr Expr `json:"expr"` Rparen int `json:"rparen"` Where Expr `json:"where"` }
An Agg is an AST node that represents a aggregate function. The Name field indicates the aggregation method while the Expr field indicates an expression applied to the incoming records that is operated upon by them aggregate function. If Expr isn't present, then the aggregator doesn't act upon a function of the record, e.g., count() counts up records without looking into them.
type ArrayExpr ¶
type ArrayExpr struct { Kind string `json:"kind" unpack:""` Lbrack int `json:"lbrack"` Elems []VectorElem `json:"elems"` Rbrack int `json:"rbrack"` }
type Assert ¶ added in v1.16.0
type Assert struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Expr Expr `json:"expr"` Text string `json:"text"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Assignment ¶
type Assignment struct { Kind string `json:"kind" unpack:""` LHS Expr `json:"lhs"` RHS Expr `json:"rhs"` }
func (*Assignment) End ¶ added in v1.16.0
func (a *Assignment) End() int
func (*Assignment) ExprAST ¶
func (*Assignment) ExprAST()
func (*Assignment) Pos ¶ added in v1.16.0
func (a *Assignment) Pos() int
type Assignments ¶ added in v1.16.0
type Assignments []Assignment
func (Assignments) End ¶ added in v1.16.0
func (a Assignments) End() int
func (Assignments) Pos ¶ added in v1.16.0
func (a Assignments) Pos() int
type BinaryExpr ¶
type BinaryExpr struct { Kind string `json:"kind" unpack:""` Op string `json:"op"` LHS Expr `json:"lhs"` RHS Expr `json:"rhs"` }
A BinaryExpr is any expression of the form "lhs kind rhs" including arithmetic (+, -, *, /), logical operators (and, or), comparisons (=, !=, <, <=, >, >=), and a dot expression (".") (on records).
func (*BinaryExpr) End ¶ added in v1.16.0
func (b *BinaryExpr) End() int
func (*BinaryExpr) ExprAST ¶
func (*BinaryExpr) ExprAST()
func (*BinaryExpr) Pos ¶ added in v1.16.0
func (b *BinaryExpr) Pos() int
type Call ¶
type Call struct { Kind string `json:"kind" unpack:""` Name *ID `json:"name"` Args []Expr `json:"args"` Rparen int `json:"rparen"` Where Expr `json:"where"` }
A Call represents different things dependending on its context. As a operator, it is either a group-by with no group-by keys and no duration, or a filter with a function that is boolean valued. This is determined by the compiler rather than the syntax tree based on the specific functions and aggregators that are defined at compile time. In expression context, a function call has the standard semantics where it takes one or more arguments and returns a result.
type Cast ¶
type Conditional ¶
type Conditional struct { Kind string `json:"kind" unpack:""` Cond Expr `json:"cond"` Then Expr `json:"then"` Else Expr `json:"else"` }
func (*Conditional) End ¶ added in v1.16.0
func (c *Conditional) End() int
func (*Conditional) ExprAST ¶
func (*Conditional) ExprAST()
func (*Conditional) Pos ¶ added in v1.16.0
func (c *Conditional) Pos() int
type ConstDecl ¶ added in v1.4.0
type Cut ¶
type Cut struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Args Assignments `json:"args"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Debug ¶ added in v1.18.0
type Debug struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Expr Expr `json:"expr"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Def ¶ added in v1.0.0
Def is like Assignment but the LHS is an identifier that may be later referenced. This is used for const blocks in Sequential and var blocks in a let scope.
type Drop ¶
type Drop struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Args []Expr `json:"args"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Explode ¶
type Explode struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Args []Expr `json:"args"` Type astzed.Type `json:"type"` As Expr `json:"as"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type FString ¶ added in v1.16.0
type FString struct { Kind string `json:"kind" unpack:""` StartPos int `json:"start_pos"` Elems []FStringElem `json:"elems"` }
type FStringElem ¶ added in v1.16.0
type FStringElem interface { Node FStringElem() }
type FStringExpr ¶ added in v1.16.0
type FStringExpr struct { Kind string `json:"kind" unpack:""` Lbrace int `json:"lbrace"` Expr Expr `json:"expr"` Rbrace int `json:"rbrace"` }
func (*FStringExpr) End ¶ added in v1.16.0
func (f *FStringExpr) End() int
func (*FStringExpr) FStringElem ¶ added in v1.16.0
func (*FStringExpr) FStringElem()
func (*FStringExpr) Pos ¶ added in v1.16.0
func (f *FStringExpr) Pos() int
type FStringText ¶ added in v1.16.0
type FStringText struct { Kind string `json:"kind" unpack:""` Text string `json:"text"` TextPos int `json:"text_pos"` }
func (*FStringText) End ¶ added in v1.16.0
func (f *FStringText) End() int
func (*FStringText) FStringElem ¶ added in v1.16.0
func (*FStringText) FStringElem()
func (*FStringText) Pos ¶ added in v1.16.0
func (f *FStringText) Pos() int
type Field ¶ added in v1.0.0
type File ¶
type From ¶
type From struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Trunks []Trunk `json:"trunks"` Rparen int `json:"rparen"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type FuncDecl ¶ added in v1.4.0
type Fuse ¶
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Glob ¶ added in v1.0.0
type Glob struct { Kind string `json:"kind" unpack:""` Pattern string `json:"pattern"` PatternPos int `json:"pattern_pos"` }
func (*Glob) PatternAST ¶ added in v1.0.0
func (*Glob) PatternAST()
type Grep ¶ added in v1.0.0
type HTTP ¶
type HTTP struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` URL Pattern `json:"url"` Format string `json:"format"` SortKeys []SortExpr `json:"sort_keys"` Method string `json:"method"` Headers *RecordExpr `json:"headers"` Body string `json:"body"` EndPos int `json:"end_pos"` }
type Head ¶
type Head struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Count Expr `json:"count"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type ID ¶
type IndexExpr ¶ added in v1.16.0
type Join ¶
type Join struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Style string `json:"style"` RightInput Seq `json:"right_input"` LeftKey Expr `json:"left_key"` RightKey Expr `json:"right_key"` Args Assignments `json:"args"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Load ¶ added in v1.8.0
type Load struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Pool string `json:"pool"` Branch string `json:"branch"` Author string `json:"author"` Message string `json:"message"` Meta string `json:"meta"` // XXX This is super hacky but so is this Op. Fix this once we can get // positional information for the various options. EndPos int `json:"end_pos"` // }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type MapExpr ¶
type Merge ¶ added in v1.0.0
type Merge struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Expr Expr `json:"expr"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Op ¶ added in v1.1.0
type Op interface { Node OpAST() }
Op is the interface implemented by all AST operator nodes.
func UnmarshalOp ¶ added in v1.8.0
UnmarshalOp transforms a JSON representation of an operator into an Op.
type OpAssignment ¶
type OpAssignment struct { Kind string `json:"kind" unpack:""` Assignments Assignments `json:"assignments"` }
An OpAssignment is a list of assignments whose parent operator is unknown: It could be a Summarize or Put operator. This will be determined in the semantic phase.
func (*OpAssignment) End ¶ added in v1.16.0
func (x *OpAssignment) End() int
func (*OpAssignment) OpAST ¶ added in v1.1.0
func (*OpAssignment) OpAST()
func (*OpAssignment) Pos ¶ added in v1.16.0
func (x *OpAssignment) Pos() int
type OpDecl ¶ added in v1.9.0
type OpExpr ¶ added in v1.0.0
An OpExpr operator is an expression that appears as an operator and requires semantic analysis to determine if it is a filter, a yield, or an aggregation.
type Output ¶ added in v1.18.0
type Output struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Name *ID `json:"name"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Over ¶ added in v1.0.0
type Over struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Exprs []Expr `json:"exprs"` Locals []Def `json:"locals"` Body Seq `json:"body"` Rparen int `json:"rparen"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type OverExpr ¶ added in v1.1.0
type Parallel ¶
type Parallel struct { Kind string `json:"kind" unpack:""` // If non-zero, MergeBy contains the field name on // which the branches of this parallel operator should be // merged in the order indicated by MergeReverse. // XXX merge_by should be a list of expressions KeywordPos int `json:"keyword_pos"` MergeBy field.Path `json:"merge_by,omitempty"` MergeReverse bool `json:"merge_reverse,omitempty"` Paths []Seq `json:"paths"` Rparen int `json:"rparen"` }
A Parallel operator represents a set of operators that each get a stream of Zed values from their parent.
type Pass ¶
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Pool ¶
type Put ¶
type Put struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Args Assignments `json:"args"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type QuotedString ¶ added in v1.9.0
type QuotedString struct { Kind string `json:"kind" unpack:""` Lquote int `json:"lquote"` Text string `json:"text"` }
func (*QuotedString) End ¶ added in v1.16.0
func (q *QuotedString) End() int
func (*QuotedString) PatternAST ¶ added in v1.9.0
func (*QuotedString) PatternAST()
func (*QuotedString) Pos ¶ added in v1.16.0
func (q *QuotedString) Pos() int
type RecordElem ¶ added in v1.0.0
type RecordElem interface { Node // contains filtered or unexported methods }
type RecordExpr ¶
type RecordExpr struct { Kind string `json:"kind" unpack:""` Lbrace int `json:"lbrace"` Elems []RecordElem `json:"elems"` Rbrace int `json:"rbrace"` }
func (*RecordExpr) End ¶ added in v1.16.0
func (r *RecordExpr) End() int
func (*RecordExpr) ExprAST ¶
func (*RecordExpr) ExprAST()
func (*RecordExpr) Pos ¶ added in v1.16.0
func (r *RecordExpr) Pos() int
type Regexp ¶ added in v1.0.0
type Regexp struct { Kind string `json:"kind" unpack:""` Pattern string `json:"pattern"` PatternPos int `json:"pattern_pos"` }
func (*Regexp) PatternAST ¶ added in v1.0.0
func (*Regexp) PatternAST()
type Rename ¶
type Rename struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Args Assignments `json:"args"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Sample ¶ added in v1.8.0
type Sample struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Expr Expr `json:"expr"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Scope ¶ added in v1.8.0
type Scope struct { Kind string `json:"kind" unpack:""` Decls []Decl `json:"decls"` Body Seq `json:"body"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Search ¶
type Search struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Expr Expr `json:"expr"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Seq ¶ added in v1.8.0
type Seq []Op
A Seq represents a sequence of operators that receive a stream of Zed values from their parent into the first operator and each subsequent operator processes the output records from the previous operator.
func UnmarshalObject ¶ added in v1.8.0
type SetExpr ¶
type SetExpr struct { Kind string `json:"kind" unpack:""` Lpipe int `json:"lpipe"` Elems []VectorElem `json:"elems"` Rpipe int `json:"rpipe"` }
type Shape ¶
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type SliceExpr ¶ added in v1.16.0
type Sort ¶
type Sort struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Reverse bool `json:"reverse"` NullsFirst bool `json:"nullsfirst"` Args []SortExpr `json:"args"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type SortExpr ¶ added in v1.18.0
type Spread ¶ added in v1.0.0
type String ¶ added in v1.0.0
type String struct { Kind string `json:"kind" unpack:""` Text string `json:"text"` TextPos int `json:"text_pos"` }
func (*String) PatternAST ¶ added in v1.0.0
func (*String) PatternAST()
type Summarize ¶
type Summarize struct { Kind string `json:"kind" unpack:""` // StartPos is not called KeywordPos for Summarize since the "summarize" // keyword is optional. StartPos int `json:"start_pos"` Limit int `json:"limit"` Keys Assignments `json:"keys"` Aggs Assignments `json:"aggs"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Switch ¶
type Switch struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Expr Expr `json:"expr"` Cases []Case `json:"cases"` Rparen int `json:"rparen"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Tail ¶
type Tail struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Count Expr `json:"count"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Term ¶ added in v1.0.0
type Top ¶
type Top struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Limit Expr `json:"limit"` Args []Expr `json:"args"` Flush bool `json:"flush"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type Trunk ¶
type TypeDecl ¶ added in v1.16.0
type UnaryExpr ¶
type Uniq ¶
type Uniq struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Cflag bool `json:"cflag"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.
type VectorElem ¶ added in v1.2.0
type VectorElem interface {
// contains filtered or unexported methods
}
type VectorValue ¶ added in v1.2.0
type Where ¶ added in v1.0.0
type Where struct { Kind string `json:"kind" unpack:""` KeywordPos int `json:"keyword_pos"` Expr Expr `json:"expr"` }
An Op is a node in the flowgraph that takes Zed values in, operates upon them, and produces Zed values as output.