Documentation
¶
Overview ¶
Package gocql2 parses OGC CQL2 filters.
Index ¶
- func SerializeJSON(expr api.Expression) ([]byte, error)
- func SerializeText(expr api.Expression) (string, error)
- type Parser
- func (p *Parser) ConformanceClasses() []string
- func (p *Parser) Parse(input []byte, lang api.Language) (api.Expression, error)
- func (p *Parser) ParseJSON(input []byte) (api.Expression, error)
- func (p *Parser) ParseText(input string) (api.Expression, error)
- func (p *Parser) SupportedFunctionDefinitions() []api.FunctionDefinition
- func (p *Parser) SupportedFunctions() []string
- func (p *Parser) SupportedProperties() []string
- func (p *Parser) SupportedPropertyDefinitions() []api.PropertyDefinition
- func (p *Parser) WithAllowedFunctions(defs ...api.FunctionDefinition) *Parser
- func (p *Parser) WithAllowedProperties(defs ...api.PropertyDefinition) *Parser
- func (p *Parser) WithConformance(classes ...string) *Parser
- func (p *Parser) WithConformanceClasses(classes ...string) *Parser
- func (p *Parser) WithMaxDepth(n int) *Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SerializeJSON ¶ added in v0.10.0
func SerializeJSON(expr api.Expression) ([]byte, error)
SerializeJSON serializes a CQL2 AST to CQL2 JSON.
func SerializeText ¶ added in v0.10.0
func SerializeText(expr api.Expression) (string, error)
SerializeText serializes a CQL2 AST to CQL2 Text.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses CQL2 and exposes the capabilities it was configured with.
func NewParser ¶
func NewParser() *Parser
NewParser builds a reusable parser. Chain setup methods before concurrent use.
func (*Parser) ConformanceClasses ¶
ConformanceClasses returns the advertised conformance class IDs.
func (*Parser) ParseJSON ¶
func (p *Parser) ParseJSON(input []byte) (api.Expression, error)
ParseJSON parses CQL2 JSON into an AST.
func (*Parser) ParseText ¶
func (p *Parser) ParseText(input string) (api.Expression, error)
ParseText parses CQL2 Text into an AST.
func (*Parser) SupportedFunctionDefinitions ¶
func (p *Parser) SupportedFunctionDefinitions() []api.FunctionDefinition
SupportedFunctionDefinitions returns the configured allowed functions.
func (*Parser) SupportedFunctions ¶
SupportedFunctions returns the advertised function names.
func (*Parser) SupportedProperties ¶
SupportedProperties returns the advertised property names.
func (*Parser) SupportedPropertyDefinitions ¶
func (p *Parser) SupportedPropertyDefinitions() []api.PropertyDefinition
SupportedPropertyDefinitions returns the configured allowed properties.
func (*Parser) WithAllowedFunctions ¶
func (p *Parser) WithAllowedFunctions(defs ...api.FunctionDefinition) *Parser
WithAllowedFunctions adds function definitions to the fail-closed function registry. Any function reference not present in the registry is rejected, and registered signatures are used to validate argument counts, argument types, and return-type contexts. Definitions added later override earlier definitions with the same normalized name.
func (*Parser) WithAllowedProperties ¶
func (p *Parser) WithAllowedProperties(defs ...api.PropertyDefinition) *Parser
WithAllowedProperties configures a fail-closed property registry. Any property reference not present in the registry is rejected, and registered types are used to validate character, numeric, comparison, and IN-list contexts.
func (*Parser) WithConformance ¶
WithConformance records CQL2 conformance classes and configures the standard functions required by those classes. Arguments may be api conformance constants, full CQL2 conformance/requirements URIs, /conf/<class> fragments, or class slugs such as "case-insensitive-comparison".
The Functions conformance class does not define any concrete function names; combine it with WithAllowedFunctions to advertise implementation-specific functions.
func (*Parser) WithConformanceClasses ¶
WithConformanceClasses records the parser's advertised conformance classes.
func (*Parser) WithMaxDepth ¶
WithMaxDepth limits recursive parse depth.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api contains public CQL2 AST and schema building blocks.
|
Package api contains public CQL2 AST and schema building blocks. |
|
internal
|
|
|
ats
Package ats contains ATS-inspired, fixture-backed CQL2 integration tests.
|
Package ats contains ATS-inspired, fixture-backed CQL2 integration tests. |
|
parser
Package parser contains the internal CQL2 parser implementation.
|
Package parser contains the internal CQL2 parser implementation. |
|
serializer
Package serializer renders parsed CQL2 AST nodes as CQL2 Text or JSON.
|
Package serializer renders parsed CQL2 AST nodes as CQL2 Text or JSON. |
|
Package sql compiles parsed CQL2 expressions to SQL fragments.
|
Package sql compiles parsed CQL2 expressions to SQL fragments. |