Skip to main content

Module sql

Module sql 

Source
Expand description

Compile GQL AST to parameterized SQL.

Two compilation paths:

  • Fixed-length patterns (all edges *1..1) → JOIN chain
  • Variable-length patterns (any edge *N..M where M>1) → recursive CTE

Security invariants (MAJ-1/MAJ-2/MAJ-3 from critic review):

  • Namespace injection: WHERE clause always comes from CompileOptions.scopes, never the query.
  • Edge property whitelist: only relation and weight are queryable edge columns.
  • Depth cap: recursive CTE depth is min(requested, 10).

Structs§

CompileOptions
CompiledQuery

Functions§

compile