MultiTableCheck

Struct MultiTableCheck 

Source
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

Source

pub fn new(name: impl Into<String>) -> Self

Create a new multi-table check builder.

§Arguments
  • name - The name of the validation check
Source

pub fn level(self, level: Level) -> Self

Set the severity level for this check.

Source

pub fn description(self, description: impl Into<String>) -> Self

Add a description for this check.

Source

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 relationship
  • right_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();
Source

pub fn and_validate_tables( self, left_table: impl Into<String>, right_table: impl Into<String>, ) -> Self

Start another table validation (convenience method).

Source

pub fn validate_temporal(self, table: impl Into<String>) -> Self

Start validating a single table for temporal constraints.

§Arguments
  • table - The table to validate
Source

pub fn and_validate_temporal(self, table: impl Into<String>) -> Self

Start another temporal validation (convenience method).

Source

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 table
  • right_column - Column from the right table
Source

pub fn join_on_multiple(self, columns: Vec<(&str, &str)>) -> Self

Specify multiple join columns (composite key).

Source

pub fn group_by(self, column: impl Into<String>) -> Self

Group results by specified columns.

Source

pub fn group_by_multiple(self, columns: Vec<impl Into<String>>) -> Self

Group results by multiple columns.

Source

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.

Source

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)
Source

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 sum
  • right_column - Column from the right table to sum
Source

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%)
Source

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 timestamps
  • after_column - Column that should contain later timestamps
Source

pub fn within_business_hours( self, start_time: impl Into<String>, end_time: impl Into<String>, ) -> Self

Validate that timestamps fall within business hours.

§Arguments
  • start_time - Start of business hours (e.g., “09:00”)
  • end_time - End of business hours (e.g., “17:00”)
Source

pub fn build(self) -> Check

Build the final Check with all configured constraints.

Trait Implementations§

Source§

impl Debug for MultiTableCheck

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,