Documentation
¶
Overview ¶
Package filter provides SCIM filter expression parsing and evaluation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterResources ¶
FilterResources filters a slice of resources using a filter expression.
Types ¶
type AttributePath ¶
type AttributePath struct {
URIPrefix string // Optional schema URI prefix
AttributeName string // Main attribute name
SubAttribute string // Optional sub-attribute
ValueFilter Node // Optional value filter for multi-valued attributes
}
AttributePath represents a parsed attribute path.
func ParseAttributePath ¶
func ParseAttributePath(path string) (*AttributePath, error)
ParseAttributePath parses an attribute path string.
func (*AttributePath) FullPath ¶
func (ap *AttributePath) FullPath() string
FullPath returns the full attribute path including sub-attribute.
func (*AttributePath) String ¶
func (ap *AttributePath) String() string
String returns the string representation of the attribute path.
type ComparisonNode ¶
ComparisonNode represents a comparison expression (e.g., "userName eq 'john'").
func (*ComparisonNode) String ¶
func (n *ComparisonNode) String() string
String returns the string representation of the node.
type Evaluator ¶
type Evaluator struct {
// AttributeResolver resolves attribute values from a resource.
AttributeResolver func(resource any, attrPath string) (any, bool)
}
Evaluator evaluates filter expressions against SCIM resources.
func DefaultEvaluator ¶
func DefaultEvaluator() *Evaluator
DefaultEvaluator returns an evaluator with a reflection-based attribute resolver.
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer tokenizes a SCIM filter expression.
type LogicalAndNode ¶
LogicalAndNode represents a logical AND expression.
func (*LogicalAndNode) String ¶
func (n *LogicalAndNode) String() string
String returns the string representation of the node.
type LogicalNotNode ¶
type LogicalNotNode struct {
Operand Node
}
LogicalNotNode represents a logical NOT expression.
func (*LogicalNotNode) String ¶
func (n *LogicalNotNode) String() string
String returns the string representation of the node.
type LogicalOrNode ¶
LogicalOrNode represents a logical OR expression.
func (*LogicalOrNode) String ¶
func (n *LogicalOrNode) String() string
String returns the string representation of the node.
type Node ¶
Node represents a node in the filter AST.
func ParseFilter ¶
ParseFilter parses a SCIM filter string and returns the AST.
type Operator ¶
type Operator string
Operator represents a SCIM filter operator.
const ( OpEqual Operator = "eq" OpNotEqual Operator = "ne" OpContains Operator = "co" OpStartsWith Operator = "sw" OpEndsWith Operator = "ew" OpPresent Operator = "pr" OpGreaterThan Operator = "gt" OpGreaterThanOrEqual Operator = "ge" OpLessThan Operator = "lt" OpLessThanOrEqual Operator = "le" )
Filter operators as defined in RFC 7644 Section 3.4.2.2.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses SCIM filter expressions into an AST.
type Token ¶
type Token struct {
Type TokenType
Value string
Literal any // The parsed literal value for strings, numbers, booleans
}
Token represents a lexical token.
type ValuePathNode ¶
ValuePathNode represents a value path filter (e.g., "emails[type eq 'work']").
func (*ValuePathNode) String ¶
func (n *ValuePathNode) String() string
String returns the string representation of the node.