Skip to main content

Crate khive_query

Crate khive_query 

Source
Expand description

khive-query — backend-agnostic GQL/SPARQL parsing and SQL compilation.

§Two entry points

§Explicit language

use khive_query::{QueryLanguage, parse, compile, CompileOptions};

let ast = parse(QueryLanguage::Gql, "MATCH (a:concept)-[:extends]->(b) RETURN b LIMIT 10")?;
let compiled = compile(&ast, &CompileOptions::default())?;

§Auto-detect (SELECT → SPARQL, MATCH → GQL)

use khive_query::parse_auto;

let ast = parse_auto("SELECT ?a ?b WHERE { ?a :extends ?b . }")?;

Re-exports§

pub use ast::GqlQuery;
pub use ast::ReturnItem;
pub use compilers::sql::compile;
pub use compilers::sql::CompileOptions;
pub use compilers::sql::CompiledQuery;
pub use error::QueryError;
pub use validate::validate;
pub use validate::validate_with_warnings;
pub use validate::MAX_DEPTH;

Modules§

ast
GQL abstract syntax tree.
compilers
error
parsers
validate
AST validation per ADR-008 §Validation Rules.

Enums§

QueryLanguage
Which query language the input is written in.

Functions§

parse
Parse a query string in the given language into a GqlQuery AST.
parse_auto
Auto-detect language and parse.