Documentation ¶
Index ¶
- func BitwiseAnd(lhs, rhs *api.Expression) *api.Expression
- func Equal(lhs, rhs *api.Expression) *api.Expression
- func GreaterThan(lhs, rhs *api.Expression) *api.Expression
- func GreaterThanEqualTo(lhs, rhs *api.Expression) *api.Expression
- func Identifier(name string) *api.Expression
- func IsNotNull(operand *api.Expression) *api.Expression
- func IsNull(operand *api.Expression) *api.Expression
- func IsValueTrue(value *api.Value) bool
- func LessThan(lhs, rhs *api.Expression) *api.Expression
- func LessThanEqualTo(lhs, rhs *api.Expression) *api.Expression
- func Like(lhs, rhs *api.Expression) *api.Expression
- func LogicalAnd(lhs, rhs *api.Expression) *api.Expression
- func LogicalOr(lhs, rhs *api.Expression) *api.Expression
- func NewValue(i interface{}) *api.Value
- func NotEqual(lhs, rhs *api.Expression) *api.Expression
- func Value(i interface{}) *api.Expression
- type Expression
- type FieldTypeMap
- type FieldValueMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BitwiseAnd ¶
func BitwiseAnd(lhs, rhs *api.Expression) *api.Expression
BitwiseAnd creates a new BINARY_AND binary Expression node.
func Equal ¶
func Equal(lhs, rhs *api.Expression) *api.Expression
Equal creates a new EQ binary Expression node.
func GreaterThan ¶
func GreaterThan(lhs, rhs *api.Expression) *api.Expression
GreaterThan creates a new GT binary expression node.
func GreaterThanEqualTo ¶
func GreaterThanEqualTo(lhs, rhs *api.Expression) *api.Expression
GreaterThanEqualTo creates a new GE binary expression node.
func Identifier ¶
func Identifier(name string) *api.Expression
Identifier creates a new IDENTIFIER Expression node.
func IsNotNull ¶
func IsNotNull(operand *api.Expression) *api.Expression
IsNotNull creates a new IS_NOT_NULL unary Expression node
func IsNull ¶
func IsNull(operand *api.Expression) *api.Expression
IsNull creates a new IS_NULL unary Expression node
func IsValueTrue ¶
IsValueTrue determines whether a value's truth value is true or false. Strings are true if they contain one or more characters. Any numeric type is true if it is non-zero.
func LessThan ¶
func LessThan(lhs, rhs *api.Expression) *api.Expression
LessThan creates a new LT binary Expression node.
func LessThanEqualTo ¶
func LessThanEqualTo(lhs, rhs *api.Expression) *api.Expression
LessThanEqualTo creates a new LE binary Expression node.
func Like ¶
func Like(lhs, rhs *api.Expression) *api.Expression
Like creates a new LIKE binary Expression node.
func LogicalAnd ¶
func LogicalAnd(lhs, rhs *api.Expression) *api.Expression
LogicalAnd creates a new LOGICAL_AND binary Expression node. If either lhs or rhs is nil, the other will be returned
func LogicalOr ¶
func LogicalOr(lhs, rhs *api.Expression) *api.Expression
LogicalOr creates a new LOGICAL_OR binary Expression node. If either lhs or rhs is nil, the other will be returned
func NewValue ¶
NewValue creates a new Value instance from a native Go type. If a Go type is used that does not have a Value equivalent, the return will be nil.
func NotEqual ¶
func NotEqual(lhs, rhs *api.Expression) *api.Expression
NotEqual creates a new NE binary Expression node.
Types ¶
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression is a wrapper around expressions around the API. It may contain internal information that is used to better support the raw representation.
func NewExpression ¶
func NewExpression(tree *api.Expression) (*Expression, error)
NewExpression instantiates a new Expression instance. The expression tree that is passed is validated to ensure that it is well-formed.
func (*Expression) Evaluate ¶
func (expr *Expression) Evaluate(types FieldTypeMap, values FieldValueMap) (*api.Value, error)
Evaluate evaluates an expression using the specified type and value information, and returns the result of that evaluation or an error. Any identifier not present in the types map is considered to be an undefined field and any reference to it is an error. Any identifier present in the types map, but not present in the values map is considered to be NULL; all comparisons against NULL will always evaluate FALSE.
func (*Expression) KernelFilterString ¶
func (expr *Expression) KernelFilterString() string
KernelFilterString returns a string representation of an expression that is suitable for setting a kernel perf_event filter. This is mostly the same as a normal string representation of the expression; however, a few adjustments are needed for the kernel.
func (*Expression) String ¶
func (expr *Expression) String() string
Return the string representation of an expression.
func (*Expression) Validate ¶
func (expr *Expression) Validate(types FieldTypeMap) error
Validate ensures that an expression is properly constructed with the specified type information. Any identifier not present in the types map is considered to be an undefined field and any reference to it is an error.
func (*Expression) ValidateKernelFilter ¶
func (expr *Expression) ValidateKernelFilter() error
ValidateKernelFilter determins whether an expression can be represented as a kernel filter string. If the result is nil, the kernel will most likely accept the expression as a filter. No check is done on the number of predicates in the expression, and some kernel versions do not support bitwise-and; however, this validator will accept bitwise-and because most do. Kernel limits on the number of predicates can vary, so it's not checked. If an expression passes this validation, it is not guaranteed that a given running kernel will absolutely accept it.
type FieldTypeMap ¶
FieldTypeMap is a mapping of types for field names/identifiers
type FieldValueMap ¶
type FieldValueMap map[string]interface{}
FieldValueMap is a mapping of values for field names/identifiers.