pub struct SchemaFingerprint { /* private fields */ }Expand description
A versioned schema digest. The version travels with the digest rather than being read from the current constant: a fingerprint loaded from storage was computed under whatever format was current when it was written, and drift detection is only sound if a v1 digest keeps reporting v1.
Implementations§
Source§impl SchemaFingerprint
impl SchemaFingerprint
Sourcepub fn of_table(kind: DatabaseObjectKind, table: &Table) -> Self
pub fn of_table(kind: DatabaseObjectKind, table: &Table) -> Self
Covers only kind, column name, type, and nullability because SchemaTree
carries nothing else today. Adding keys or comments later must bump
FINGERPRINT_VERSION.
Sourcepub fn from_parts(version: u32, digest: &str) -> Result<Self, ContractError>
pub fn from_parts(version: u32, digest: &str) -> Result<Self, ContractError>
Rebuilds a fingerprint from its two stored columns. Persistence layers hold the digest and its version separately, so this is how a stored fingerprint comes back without laundering it through the current format version.
Sourcepub const fn version(&self) -> u32
pub const fn version(&self) -> u32
The format version this digest was computed under — not necessarily the
current FINGERPRINT_VERSION.
Sourcepub const fn is_current_format(&self) -> bool
pub const fn is_current_format(&self) -> bool
True when this digest was produced by the format the running binary uses. A mismatch means the digest cannot be compared, only recomputed.
pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl Clone for SchemaFingerprint
impl Clone for SchemaFingerprint
Source§fn clone(&self) -> SchemaFingerprint
fn clone(&self) -> SchemaFingerprint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more