Documentation
¶
Index ¶
- func Parse[K comparable, P float32 | float64](q string) (cmd CommandNode, warns []Warning, err error)
- type AnchorFieldNode
- func (n AnchorFieldNode) Clause() *ClauseNode
- func (n AnchorFieldNode) End() lexer.Position
- func (n AnchorFieldNode) Field() FieldNode[string]
- func (n AnchorFieldNode) Key() string
- func (n AnchorFieldNode) Pos() lexer.Position
- func (n AnchorFieldNode) String() string
- func (n AnchorFieldNode) Value() string
- type AstNode
- type ClauseNode
- type ClauseType
- type CommandNode
- type DepthFieldNode
- type EntityFieldNode
- type Error
- type FieldNode
- type GraphSelectorNode
- type LiteralFieldNode
- type PhraseNode
- type RecallCommandNode
- func (r RecallCommandNode[K, P]) Depth(v int) int
- func (n RecallCommandNode[K, P]) End() lexer.Position
- func (r RecallCommandNode[K, P]) Entities() []string
- func (r RecallCommandNode[K, P]) HasDepth() bool
- func (r RecallCommandNode[K, P]) HasTop() bool
- func (n RecallCommandNode[K, P]) Pos() lexer.Position
- func (n RecallCommandNode[K, P]) Selector() uint8
- func (r RecallCommandNode[K, P]) Since() containers.TimeValue[K]
- func (n RecallCommandNode[K, P]) String() string
- func (r RecallCommandNode[K, P]) Terms() []string
- func (r RecallCommandNode[K, P]) Top(v int) int
- func (r RecallCommandNode[K, P]) Topics() []string
- func (r RecallCommandNode[K, P]) Until() containers.TimeValue[K]
- func (r RecallCommandNode[K, P]) VecParam() (string, bool)
- func (r RecallCommandNode[K, P]) Vector() []P
- type RefFieldNode
- type RememberCommandNode
- func (n RememberCommandNode[P]) End() lexer.Position
- func (r RememberCommandNode[P]) Entities() []string
- func (n RememberCommandNode[P]) Pos() lexer.Position
- func (n RememberCommandNode[P]) Selector() uint8
- func (n RememberCommandNode[P]) String() string
- func (r RememberCommandNode[P]) Topics() []string
- func (r RememberCommandNode[P]) Value() string
- func (r RememberCommandNode[P]) VecParam() (string, bool)
- func (r RememberCommandNode[P]) Vector() []P
- type SinceFieldNode
- type TermNode
- type Terms
- type TimeValueFieldNode
- type TopFieldNode
- type TopicFieldNode
- type UntilFieldNode
- type VecFieldNode
- type Warning
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
func Parse[K comparable, P float32 | float64](q string) (cmd CommandNode, warns []Warning, err error)
Types ¶
type AnchorFieldNode ¶
type AnchorFieldNode struct {
// contains filtered or unexported fields
}
Search nodes are particular nodes using for graph and full text search (entity, topic)
func (AnchorFieldNode) Clause ¶
func (n AnchorFieldNode) Clause() *ClauseNode
func (AnchorFieldNode) End ¶
func (n AnchorFieldNode) End() lexer.Position
func (AnchorFieldNode) Field ¶
func (n AnchorFieldNode) Field() FieldNode[string]
func (AnchorFieldNode) Key ¶
func (n AnchorFieldNode) Key() string
func (AnchorFieldNode) Pos ¶
func (n AnchorFieldNode) Pos() lexer.Position
func (AnchorFieldNode) String ¶
func (n AnchorFieldNode) String() string
func (AnchorFieldNode) Value ¶
func (n AnchorFieldNode) Value() string
type ClauseNode ¶
type ClauseNode struct {
// contains filtered or unexported fields
}
type ClauseType ¶
type ClauseType int
const ( MUST ClauseType = iota // + MUST_NOT // - LOOSE // ± )
type CommandNode ¶
Node representing a command (remember, recall)
type DepthFieldNode ¶
type DepthFieldNode struct {
// contains filtered or unexported fields
}
Depth field
func (DepthFieldNode) End ¶
func (n DepthFieldNode) End() lexer.Position
func (DepthFieldNode) Key ¶
func (n DepthFieldNode) Key() string
func (DepthFieldNode) Pos ¶
func (n DepthFieldNode) Pos() lexer.Position
func (DepthFieldNode) String ¶
func (n DepthFieldNode) String() string
func (DepthFieldNode) Value ¶
func (n DepthFieldNode) Value() int
type EntityFieldNode ¶
type EntityFieldNode struct {
// contains filtered or unexported fields
}
Entity field
func (EntityFieldNode) End ¶
func (n EntityFieldNode) End() lexer.Position
func (EntityFieldNode) Key ¶
func (n EntityFieldNode) Key() string
func (EntityFieldNode) Pos ¶
func (n EntityFieldNode) Pos() lexer.Position
func (EntityFieldNode) String ¶
func (n EntityFieldNode) String() string
func (EntityFieldNode) Value ¶
func (n EntityFieldNode) Value() string
type Error ¶
Error is a parse failure at a specific position in the query. It is returned (wrapped) by the query layer; recover it with errors.As to get the position.
type GraphSelectorNode ¶
type GraphSelectorNode struct {
// contains filtered or unexported fields
}
Selector node is the graph selection statement
func (GraphSelectorNode) End ¶
func (n GraphSelectorNode) End() lexer.Position
func (GraphSelectorNode) Pos ¶
func (n GraphSelectorNode) Pos() lexer.Position
func (GraphSelectorNode) String ¶
func (n GraphSelectorNode) String() string
func (GraphSelectorNode) Value ¶
func (n GraphSelectorNode) Value() uint8
type PhraseNode ¶
type PhraseNode struct {
// contains filtered or unexported fields
}
Phrase representation. A phrase is a quoted text search
func (PhraseNode) End ¶
func (n PhraseNode) End() lexer.Position
func (PhraseNode) Literal ¶
func (n PhraseNode) Literal() string
Literal returns the phrase text exactly as written between the quotes, with the escape (”) already decoded and no surrounding quotes. Interior spacing is preserved verbatim — the phrase is opaque literal text.
func (PhraseNode) Pos ¶
func (n PhraseNode) Pos() lexer.Position
func (PhraseNode) String ¶
func (n PhraseNode) String() string
type RecallCommandNode ¶
type RecallCommandNode[K comparable, P float32 | float64] struct { // contains filtered or unexported fields }
recall command node
func (RecallCommandNode[K, P]) Depth ¶
func (r RecallCommandNode[K, P]) Depth(v int) int
func (RecallCommandNode[K, P]) End ¶
func (n RecallCommandNode[K, P]) End() lexer.Position
func (RecallCommandNode[K, P]) Entities ¶
func (r RecallCommandNode[K, P]) Entities() []string
func (RecallCommandNode[K, P]) HasDepth ¶
func (r RecallCommandNode[K, P]) HasDepth() bool
HasDepth reports whether the recall carried an explicit depth clause, as opposed to falling back to the configured default. Presence is the parsed depth key, not a nonzero value, so an explicit depth:0 is honoured as the floor lane instead of collapsing to the default.
func (RecallCommandNode[K, P]) HasTop ¶
func (r RecallCommandNode[K, P]) HasTop() bool
HasTop reports whether the recall carried an explicit top clause, as opposed to falling back to the configured default. Presence is the parsed top key, not a nonzero value, so an explicit top:0 stays visible to the range check and is rejected as out of range instead of silently answering with the default. Ceiling checks apply only to a client-supplied value, never to the trusted default.
func (RecallCommandNode[K, P]) Pos ¶
func (n RecallCommandNode[K, P]) Pos() lexer.Position
func (RecallCommandNode[K, P]) Selector ¶
func (n RecallCommandNode[K, P]) Selector() uint8
func (RecallCommandNode[K, P]) Since ¶
func (r RecallCommandNode[K, P]) Since() containers.TimeValue[K]
func (RecallCommandNode[K, P]) String ¶
func (n RecallCommandNode[K, P]) String() string
func (RecallCommandNode[K, P]) Terms ¶
func (r RecallCommandNode[K, P]) Terms() []string
func (RecallCommandNode[K, P]) Top ¶
func (r RecallCommandNode[K, P]) Top(v int) int
func (RecallCommandNode[K, P]) Topics ¶
func (r RecallCommandNode[K, P]) Topics() []string
func (RecallCommandNode[K, P]) Until ¶
func (r RecallCommandNode[K, P]) Until() containers.TimeValue[K]
func (RecallCommandNode[K, P]) VecParam ¶
func (r RecallCommandNode[K, P]) VecParam() (string, bool)
VecParam reports the name of the vector placeholder (the identifier after `vec:$`) and whether the recall carried one at all. The parser only records the placeholder; the real vector is bound later from the request parameters.
func (RecallCommandNode[K, P]) Vector ¶
func (r RecallCommandNode[K, P]) Vector() []P
type RefFieldNode ¶
Ref field
type RememberCommandNode ¶
remember command node
func (RememberCommandNode[P]) End ¶
func (n RememberCommandNode[P]) End() lexer.Position
func (RememberCommandNode[P]) Entities ¶
func (r RememberCommandNode[P]) Entities() []string
func (RememberCommandNode[P]) Pos ¶
func (n RememberCommandNode[P]) Pos() lexer.Position
func (RememberCommandNode[P]) Selector ¶
func (n RememberCommandNode[P]) Selector() uint8
func (RememberCommandNode[P]) String ¶
func (n RememberCommandNode[P]) String() string
func (RememberCommandNode[P]) Topics ¶
func (r RememberCommandNode[P]) Topics() []string
func (RememberCommandNode[P]) Value ¶
func (r RememberCommandNode[P]) Value() string
func (RememberCommandNode[P]) VecParam ¶
func (r RememberCommandNode[P]) VecParam() (string, bool)
func (RememberCommandNode[P]) Vector ¶
func (r RememberCommandNode[P]) Vector() []P
type SinceFieldNode ¶
type SinceFieldNode[K comparable] struct { // contains filtered or unexported fields }
Since field
func (SinceFieldNode[K]) End ¶
func (n SinceFieldNode[K]) End() lexer.Position
func (SinceFieldNode[K]) Key ¶
func (n SinceFieldNode[K]) Key() string
func (SinceFieldNode[K]) Pos ¶
func (n SinceFieldNode[K]) Pos() lexer.Position
func (SinceFieldNode[K]) String ¶
func (n SinceFieldNode[K]) String() string
func (SinceFieldNode[K]) TimeValue ¶
func (n SinceFieldNode[K]) TimeValue() time.Time
func (SinceFieldNode[K]) Value ¶
func (n SinceFieldNode[K]) Value() containers.TimeValue[K]
type TermNode ¶
type TermNode struct {
// contains filtered or unexported fields
}
a term is a search keyword or phrase. A query supports multiple terms or one phrase
func (TermNode) Literal ¶
Literal returns the term as the parser interpreted it: folded to lower case. The token keeps the source spelling for positions and error text; matching and cache keys must see only this folded form, or one search would exist under as many plan-cache entries as it has capitalisations.
type TimeValueFieldNode ¶
type TimeValueFieldNode[K comparable] interface { FieldNode[containers.TimeValue[K]] TimeValue() time.Time }
type TopFieldNode ¶
type TopFieldNode struct {
// contains filtered or unexported fields
}
Top field
func (TopFieldNode) End ¶
func (n TopFieldNode) End() lexer.Position
func (TopFieldNode) Key ¶
func (n TopFieldNode) Key() string
func (TopFieldNode) Pos ¶
func (n TopFieldNode) Pos() lexer.Position
func (TopFieldNode) String ¶
func (n TopFieldNode) String() string
func (TopFieldNode) Value ¶
func (n TopFieldNode) Value() int
type TopicFieldNode ¶
type TopicFieldNode struct {
// contains filtered or unexported fields
}
Topic field
func (TopicFieldNode) End ¶
func (n TopicFieldNode) End() lexer.Position
func (TopicFieldNode) Key ¶
func (n TopicFieldNode) Key() string
func (TopicFieldNode) Pos ¶
func (n TopicFieldNode) Pos() lexer.Position
func (TopicFieldNode) String ¶
func (n TopicFieldNode) String() string
func (TopicFieldNode) Value ¶
func (n TopicFieldNode) Value() string
type UntilFieldNode ¶
type UntilFieldNode[K comparable] struct { // contains filtered or unexported fields }
Until field
func (UntilFieldNode[K]) End ¶
func (n UntilFieldNode[K]) End() lexer.Position
func (UntilFieldNode[K]) Key ¶
func (n UntilFieldNode[K]) Key() string
func (UntilFieldNode[K]) Pos ¶
func (n UntilFieldNode[K]) Pos() lexer.Position
func (UntilFieldNode[K]) String ¶
func (n UntilFieldNode[K]) String() string
func (UntilFieldNode[K]) TimeValue ¶
func (n UntilFieldNode[K]) TimeValue() time.Time
func (UntilFieldNode[K]) Value ¶
func (n UntilFieldNode[K]) Value() containers.TimeValue[K]
type VecFieldNode ¶
Ref field
func (VecFieldNode[P]) End ¶
func (n VecFieldNode[P]) End() lexer.Position
func (VecFieldNode[P]) Key ¶
func (n VecFieldNode[P]) Key() string
func (VecFieldNode[P]) Param ¶
func (n VecFieldNode[P]) Param() string
func (VecFieldNode[P]) Pos ¶
func (n VecFieldNode[P]) Pos() lexer.Position
func (VecFieldNode[P]) String ¶
func (n VecFieldNode[P]) String() string
func (VecFieldNode[P]) Value ¶
func (n VecFieldNode[P]) Value() []P
type Warning ¶
Warning is a parse-time observation about a query that ran anyway: the query is valid, but it is close enough to a different, also-valid query that a typo would change its meaning with no error to correct from. It rides the return path, never the query object — the plan cache substitutes query objects on a hash hit, so anything attached there would leak between requests.