Skip to main content

Module sql_parser

Module sql_parser 

Source
Expand description

Thin wrapper over the sqlparser crate that produces a normalized SqlAnalysis for the guard to evaluate.

Goals:

  • Keep sqlparser types out of the guard surface. Everything the guard consumes is a plain String, Vec<String>, or an SqlOperation.
  • Extract the four things the guard cares about: the operation class, the referenced tables, the projected columns per table (for SELECT only), and whether a WHERE clause is present.
  • Fail-closed on parse errors: returning an Err causes the guard to deny.

Structs§

SqlAnalysis
Normalized view of a parsed SQL statement.

Functions§

parse
Parse query and return a normalized analysis. Parse errors are returned as [Err(String)] so the guard can build a SqlGuardDenyReason::ParseError from them.