Skip to main content

parse_auto

Function parse_auto 

Source
pub fn parse_auto(input: &str) -> Result<GqlQuery, QueryError>
Expand description

Auto-detect language and parse (SELECT → SPARQL, MATCH → GQL, fallback → GQL).

Write-shaped input is rejected before dialect dispatch with a clear, actionable error naming the mutation verbs to use instead. This guard runs first so that forms such as WITH <g> DELETE … and PREFIX ex: <…> INSERT DATA { … } — which don’t start with SELECT and therefore fall through to the GQL path — are caught on the public entry point rather than producing a generic parse error.

The per-parser guards in parsers::gql and parsers::sparql remain in place for defense-in-depth for direct callers of those functions.