pub struct NormalizedBody { /* private fields */ }Expand description
A canonicalized statement-scope body.
Implementations§
Source§impl NormalizedBody
impl NormalizedBody
Sourcepub const fn empty() -> Self
pub const fn empty() -> Self
Sentinel for source-parse provisional records.
T4’s AST canonicalization pass overwrites this immediately after the source IR is assembled. Never serialized to plan output.
Sourcepub fn from_raw_canonical(canonical_text: String) -> Self
pub fn from_raw_canonical(canonical_text: String) -> Self
Build a NormalizedBody from a pre-computed canonical text string.
Used by the PL/pgSQL and SQL body parsers in parse::builder::plpgsql
which produce their own canonical form (whitespace-collapsed text or
pg_query::normalize output) and need to inject it directly.
Callers are responsible for ensuring canonical_text is in the
pgevolve canonical form (whitespace collapsed, keywords lowercased).
Sourcepub fn from_sql(sql: &str) -> Result<Self, BodyError>
pub fn from_sql(sql: &str) -> Result<Self, BodyError>
Canonicalize a body given its raw SQL text.
The body may be any complete SQL statement (SELECT, CREATE VIEW,
etc.). Invalid SQL returns BodyError::Parse. If the deparser
unexpectedly fails on a successfully-parsed tree, the original SQL is
used as the canonical form (silent graceful degradation).
Sourcepub fn canonical_text(&self) -> &str
pub fn canonical_text(&self) -> &str
The canonical text. Two bodies are equivalent iff their canonical texts are byte-equal.
Sourcepub fn canonical_hash(&self) -> &[u8; 32]
pub fn canonical_hash(&self) -> &[u8; 32]
BLAKE3 hash of the canonical text. Domain-separated with
pgevolve-normalized-body-v1\n to avoid collisions with
crate::plan::plan::PlanId hashes (pgevolve-plan-id-v1\n).
Not const fn: NormalizedBody is only constructed at runtime (via
pg_query), so const would signal intent the type cannot fulfill.
Trait Implementations§
Source§impl Clone for NormalizedBody
impl Clone for NormalizedBody
Source§fn clone(&self) -> NormalizedBody
fn clone(&self) -> NormalizedBody
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NormalizedBody
impl Debug for NormalizedBody
Source§impl<'de> Deserialize<'de> for NormalizedBody
impl<'de> Deserialize<'de> for NormalizedBody
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for NormalizedBody
Source§impl Hash for NormalizedBody
impl Hash for NormalizedBody
Source§impl PartialEq for NormalizedBody
impl PartialEq for NormalizedBody
Source§fn eq(&self, other: &NormalizedBody) -> bool
fn eq(&self, other: &NormalizedBody) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for NormalizedBody
impl Serialize for NormalizedBody
impl StructuralPartialEq for NormalizedBody
Auto Trait Implementations§
impl Freeze for NormalizedBody
impl RefUnwindSafe for NormalizedBody
impl Send for NormalizedBody
impl Sync for NormalizedBody
impl Unpin for NormalizedBody
impl UnsafeUnpin for NormalizedBody
impl UnwindSafe for NormalizedBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more