Documentation ¶
Index ¶
- Constants
- func Register(resourceType *spec.ResourceType)
- type Expression
- func (e *Expression) ContainsFilter() bool
- func (e *Expression) IsLeftParenthesis() bool
- func (e *Expression) IsLiteral() bool
- func (e *Expression) IsLogicalOperator() bool
- func (e *Expression) IsOperator() bool
- func (e *Expression) IsParenthesis() bool
- func (e *Expression) IsPath() bool
- func (e *Expression) IsRelationalOperator() bool
- func (e *Expression) IsRightParenthesis() bool
- func (e *Expression) IsRootOfFilter() bool
- func (e *Expression) Left() *Expression
- func (e *Expression) Next() *Expression
- func (e *Expression) Right() *Expression
- func (e *Expression) Token() string
- func (e *Expression) Walk(cb func(expression *Expression), marker *Expression, done func())
Constants ¶
const ( // Query tokens LeftParen = "(" RightParen = ")" And = "and" Or = "or" Not = "not" Eq = "eq" Ne = "ne" Sw = "sw" Ew = "ew" Co = "co" Pr = "pr" Gt = "gt" Ge = "ge" Lt = "lt" Le = "le" )
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(resourceType *spec.ResourceType)
Register the resource type to correctly use expression package's compiler capability. This method caches all schema urn ids available in a resource type, so they can be recognized later when an expression that contains one is passed in as an argument to compiler.
Types ¶
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
An expression is a basic unit in filters and paths. It maintains relation with other expressions as a node in linked list and tree to form the entire filter and/or path.
func CompileFilter ¶
func CompileFilter(filter string) (*Expression, error)
Create a SCIM filter and return the root of the abstract syntax tree, or any error.
func CompilePath ¶
func CompilePath(path string) (*Expression, error)
Create a new SCIM path expression, returns the head of the path expression linked list, or any error. The result may contain a filter root node, depending on the given path expression.
func NewPath ¶
func NewPath(paths ...string) *Expression
Create a new path expression list, composed of nodes from the paths arguments. This function simply assembles the linked list and does not go through the compiler mechanism.
func (*Expression) ContainsFilter ¶
func (e *Expression) ContainsFilter() bool
Returns true if the remaining of the path whose first node is represented by this expression contains a filter.
func (*Expression) IsLeftParenthesis ¶
func (e *Expression) IsLeftParenthesis() bool
func (*Expression) IsLiteral ¶
func (e *Expression) IsLiteral() bool
func (*Expression) IsLogicalOperator ¶
func (e *Expression) IsLogicalOperator() bool
func (*Expression) IsOperator ¶
func (e *Expression) IsOperator() bool
func (*Expression) IsParenthesis ¶
func (e *Expression) IsParenthesis() bool
func (*Expression) IsPath ¶
func (e *Expression) IsPath() bool
func (*Expression) IsRelationalOperator ¶
func (e *Expression) IsRelationalOperator() bool
func (*Expression) IsRightParenthesis ¶
func (e *Expression) IsRightParenthesis() bool
func (*Expression) IsRootOfFilter ¶
func (e *Expression) IsRootOfFilter() bool
func (*Expression) Left ¶
func (e *Expression) Left() *Expression
func (*Expression) Next ¶
func (e *Expression) Next() *Expression
func (*Expression) Right ¶
func (e *Expression) Right() *Expression
func (*Expression) Token ¶
func (e *Expression) Token() string
func (*Expression) Walk ¶
func (e *Expression) Walk(cb func(expression *Expression), marker *Expression, done func())
Traverse the hybrid linked list / tree structure connected to the current step. cb is the callback function invoked for each step; marker and done comprises the termination mechanism. When the current step finishes its traversal, it compares itself against marker. If they are equal, invoke the done function to let the caller know we have returned to the node that the Walk function is initially invoked on, hence the traversal has ended.