pub struct MultiTableCheck { /* private fields */ }Expand description
Fluent builder for multi-table validation checks.
This builder provides an intuitive API for constructing complex validation scenarios involving multiple tables, making it easier to express complex relationships and consistency requirements.
Implementations§
Source§impl MultiTableCheck
impl MultiTableCheck
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Add a description for this check.
Sourcepub fn validate_tables(
self,
left_table: impl Into<String>,
right_table: impl Into<String>,
) -> Self
pub fn validate_tables( self, left_table: impl Into<String>, right_table: impl Into<String>, ) -> Self
Start validating a relationship between two tables.
§Arguments
left_table- The left table in the relationshipright_table- The right table in the relationship
§Example
use term_guard::core::MultiTableCheck;
let check = MultiTableCheck::new("validation")
.validate_tables("orders", "customers")
.join_on("customer_id", "id")
.ensure_referential_integrity()
.build();Sourcepub fn and_validate_tables(
self,
left_table: impl Into<String>,
right_table: impl Into<String>,
) -> Self
pub fn and_validate_tables( self, left_table: impl Into<String>, right_table: impl Into<String>, ) -> Self
Start another table validation (convenience method).
Sourcepub fn validate_temporal(self, table: impl Into<String>) -> Self
pub fn validate_temporal(self, table: impl Into<String>) -> Self
Sourcepub fn and_validate_temporal(self, table: impl Into<String>) -> Self
pub fn and_validate_temporal(self, table: impl Into<String>) -> Self
Start another temporal validation (convenience method).
Sourcepub fn join_on(
self,
left_column: impl Into<String>,
right_column: impl Into<String>,
) -> Self
pub fn join_on( self, left_column: impl Into<String>, right_column: impl Into<String>, ) -> Self
Specify the join columns for the current table relationship.
§Arguments
left_column- Column from the left tableright_column- Column from the right table
Sourcepub fn join_on_multiple(self, columns: Vec<(&str, &str)>) -> Self
pub fn join_on_multiple(self, columns: Vec<(&str, &str)>) -> Self
Specify multiple join columns (composite key).
Sourcepub fn group_by_multiple(self, columns: Vec<impl Into<String>>) -> Self
pub fn group_by_multiple(self, columns: Vec<impl Into<String>>) -> Self
Group results by multiple columns.
Sourcepub fn ensure_referential_integrity(self) -> Self
pub fn ensure_referential_integrity(self) -> Self
Ensure referential integrity between the current tables.
This adds a foreign key constraint using the specified join columns.
Sourcepub fn expect_join_coverage(self, min_coverage: f64) -> Self
pub fn expect_join_coverage(self, min_coverage: f64) -> Self
Expect a specific join coverage rate.
§Arguments
min_coverage- Minimum expected coverage rate (0.0 to 1.0)
Sourcepub fn ensure_sum_consistency(
self,
left_column: impl Into<String>,
right_column: impl Into<String>,
) -> Self
pub fn ensure_sum_consistency( self, left_column: impl Into<String>, right_column: impl Into<String>, ) -> Self
Ensure sum consistency between columns in the current tables.
§Arguments
left_column- Column from the left table to sumright_column- Column from the right table to sum
Sourcepub fn with_tolerance(self, _tolerance: f64) -> Self
pub fn with_tolerance(self, _tolerance: f64) -> Self
Set tolerance for the current sum consistency constraint.
§Arguments
tolerance- Maximum allowed difference (e.g., 0.01 for 1%)
Sourcepub fn ensure_ordering(
self,
before_column: impl Into<String>,
after_column: impl Into<String>,
) -> Self
pub fn ensure_ordering( self, before_column: impl Into<String>, after_column: impl Into<String>, ) -> Self
Ensure temporal ordering between two columns.
§Arguments
before_column- Column that should contain earlier timestampsafter_column- Column that should contain later timestamps
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MultiTableCheck
impl !RefUnwindSafe for MultiTableCheck
impl Send for MultiTableCheck
impl Sync for MultiTableCheck
impl Unpin for MultiTableCheck
impl !UnwindSafe for MultiTableCheck
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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