pub enum RenderMode {
Canonical,
Parenthesized,
Redacted,
}Expand description
How a Render impl spells a node.
Variants§
Canonical
Round-trippable SQL with the minimal parentheses the binding-power table requires.
Parenthesized
Every binary/unary subexpression fully parenthesized: the precedence oracle used by testing.
Redacted
Identifier and literal content replaced by fixed placeholders — id for
every identifier, ? for every literal — while query shape is preserved,
yielding a stable, PII-free query fingerprint.
Two statements produce the same redacted string exactly when they differ only along a dimension masking erases:
- identifier spelling: every name (column, table, alias, function, and each
qualified part) becomes
id, soaandbcoincide; - identifier quoting: the delimiters are dropped before the symbol is
resolved, so
a,"a",`a`, and[a]all becomeid(a keyword spelled as an identifier masks the same way); - literal value: every literal becomes
?, so1and999,'x'and a secret string,TRUEandNULLcoincide; - keyword casing: canonical rendering upper-cases keywords, so
selectandSELECTcoincide.
Query shape is kept, so the fingerprint still separates statements that
differ in clause structure, projection/list arity, qualified-name arity
(id vs id.id), operators or keywords (= vs <, AND vs OR, SELECT
vs SELECT DISTINCT), or the parentheses the binding-power table requires.
The result is a fingerprint, not guaranteed re-parseable — only
Canonical round-trips. A masked literal renders as
?, the anonymous-parameter sigil, which only lexes under a dialect that
enables it (neither ANSI nor PostgreSQL do) and, even then, would re-parse as
a parameter rather than the literal it replaced. An identifier-only
redaction happens to re-parse, but that is incidental, not a promise.
Trait Implementations§
Source§impl Clone for RenderMode
impl Clone for RenderMode
Source§fn clone(&self) -> RenderMode
fn clone(&self) -> RenderMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more