Documentation
¶
Index ¶
Constants ¶
View Source
const ( AndKeyword = "AND" AssignKeyword = "=" ListKeyword = "," OrKeyword = "OR" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AstNode ¶
type AstNode interface {
Format(args FormatArgs) error
Fields(args *FieldArgs) error
Extract(any) error
}
AstNode defines the basic interface for evaluating expressions.
type ExtractBinary ¶
type ExtractBinary interface {
BinaryConjunction(keyword string) error
BinaryAssignment(lhs string, rhs any) error
}
Used to extract info from an AST. Experimental.
type FieldArgs ¶
type FieldArgs struct {
Fields []string
Ctx FormatContext
}
type Format ¶
type Format interface {
// Translate a keyword to the local format.
// Example, "AND" might become "&&".
Keyword(s string) string
// Convert a value to a string.
Value(v interface{}) (string, error)
}
Format provides the tokens and rules used when converting an AST to a string
func DefaultFormat ¶
func DefaultFormat() Format
type FormatArgs ¶
type FormatArgs struct {
Writer io.StringWriter
Format Format
Ctx FormatContext
Eb errors.Block
}
type FormatContext ¶
type FormatContext int
const ( NoFormatContext FormatContext = iota ValueContext // A value, i.e. the RHS of an assignment )
type Opt ¶
type Opt struct {
// Strict causes sloppy conditions to become errors. For example, comparing a
// number to a string is false if strict is off, but error if it's on.
Strict bool
// OnError is a value returned when one of the typed Eval() statements returns an error.
// Must match the type. For example, the value must be assigend a string if using EvalString().
OnError interface{}
}
Opt contains options for evaluation.
Click to show internal directories.
Click to hide internal directories.