Documentation
¶
Overview ¶
Package query defines Ridu's transport-independent query language.
The same query model is shared by access filters, local operations, the HTTP API, generated clients, and storage adapters.
Index ¶
- Constants
- type Comparison
- type Direction
- type Expression
- func And(expressions ...Expression) (Expression, error)
- func Compare(path Path, operator Operator, value Value) (Expression, error)
- func Contains(path Path, value string) Expression
- func Equal(path Path, value Value) Expression
- func GreaterThan(path Path, value Value) Expression
- func GreaterThanEqual(path Path, value Value) Expression
- func In(path Path, values ...Value) Expression
- func LessThan(path Path, value Value) Expression
- func LessThanEqual(path Path, value Value) Expression
- func Like(path Path, value string) Expression
- func Not(child Expression) (Expression, error)
- func NotEqual(path Path, value Value) Expression
- func Or(expressions ...Expression) (Expression, error)
- type ExpressionKind
- type Node
- type Operator
- type Path
- type Population
- type Sort
- type Value
- type ValueKind
Constants ¶
const ( // MaxPathSegments bounds recursive query compilation and schema traversal. // Ridu's operation engine supports substantially shallower authored models, // leaving this ceiling as a fail-safe rather than a practical restriction. MaxPathSegments = 64 // MaxPathBytes bounds user-supplied filter/sort/population path allocation. MaxPathBytes = 4096 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparison ¶
Comparison is a read-only snapshot of a comparison expression.
type Expression ¶
type Expression interface {
Kind() ExpressionKind
Node() Node
// contains filtered or unexported methods
}
Expression is an immutable query expression. Implementations are sealed so every transport and store sees the same finite query language.
func And ¶
func And(expressions ...Expression) (Expression, error)
And combines two or more expressions.
func Compare ¶
func Compare(path Path, operator Operator, value Value) (Expression, error)
Compare constructs a validated field comparison.
func Contains ¶
func Contains(path Path, value string) Expression
func GreaterThan ¶
func GreaterThan(path Path, value Value) Expression
func GreaterThanEqual ¶
func GreaterThanEqual(path Path, value Value) Expression
func LessThan ¶
func LessThan(path Path, value Value) Expression
func LessThanEqual ¶
func LessThanEqual(path Path, value Value) Expression
func Like ¶
func Like(path Path, value string) Expression
func NotEqual ¶
func NotEqual(path Path, value Value) Expression
NotEqual constructs an inequality expression.
func Or ¶
func Or(expressions ...Expression) (Expression, error)
Or combines two or more expressions.
type ExpressionKind ¶
type ExpressionKind string
ExpressionKind identifies the shape of an expression node.
const ( ExpressionComparison ExpressionKind = "comparison" ExpressionAnd ExpressionKind = "and" ExpressionOr ExpressionKind = "or" ExpressionNot ExpressionKind = "not" )
type Node ¶
type Node struct {
Kind ExpressionKind
Comparison *Comparison
Children []Node
}
Node is a detached recursive snapshot for adapters and protocol encoders. Mutating a Node never mutates the originating Expression.
type Operator ¶
type Operator string
Operator identifies a field comparison.
const ( OperatorEqual Operator = "equal" OperatorNotEqual Operator = "not_equal" OperatorIn Operator = "in" OperatorExists Operator = "exists" OperatorGreaterThan Operator = "greater_than" OperatorGreaterThanEqual Operator = "greater_than_equal" OperatorLessThan Operator = "less_than" OperatorLessThanEqual Operator = "less_than_equal" OperatorContains Operator = "contains" OperatorLike Operator = "like" )
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path is an immutable, validated document field path. Its canonical string form joins segments with a dot, for example "seo.title". The exact single-segment paths "_status" and "_revision" address Ridu's finite version metadata; arbitrary underscore-prefixed or nested system paths remain invalid.
func (Path) MarshalJSON ¶
MarshalJSON encodes a path in its canonical dot-separated form.
func (*Path) UnmarshalJSON ¶
UnmarshalJSON validates the canonical string before replacing the path.
type Population ¶
type Population struct {
Path Path
Depth int
// Select is nil for the complete populated target. A non-nil empty slice
// returns only document metadata.
Select []Path
}
Population asks a store to replace one relationship ID with its projected target document. Depth is bounded by the operation engine.
type Sort ¶
Sort is one validated ordered field term. Stores append ID as a stable tiebreaker when callers do not provide it explicitly.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is an immutable query operand. Explicit constructors prevent arbitrary application values from leaking into the public query contract.
func (Value) BooleanValue ¶
BooleanValue returns the boolean and true when this is a boolean operand.
func (Value) MarshalJSON ¶
func (Value) NumberValue ¶
NumberValue returns the number and true when this is a number operand.
func (Value) StringValue ¶
StringValue returns the string and true when this is a string operand.