pub struct Validator { /* private fields */ }Expand description
Validates query elements against known schema and provides suggestions.
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn add_table_with_types(&mut self, table: &str, cols: &[(&str, &str)])
pub fn add_table_with_types(&mut self, table: &str, cols: &[(&str, &str)])
Register a table with column types (for future type validation).
Sourcepub fn table_names(&self) -> &[String]
pub fn table_names(&self) -> &[String]
Get list of all table names (for autocomplete).
Sourcepub fn column_names(&self, table: &str) -> Option<&Vec<String>>
pub fn column_names(&self, table: &str) -> Option<&Vec<String>>
Get column names for a table (for autocomplete).
Sourcepub fn table_exists(&self, table: &str) -> bool
pub fn table_exists(&self, table: &str) -> bool
Check if a table exists.
Sourcepub fn validate_table(&self, table: &str) -> Result<(), ValidationError>
pub fn validate_table(&self, table: &str) -> Result<(), ValidationError>
Check if a table exists. If not, returns structured error with suggestion.
Sourcepub fn validate_column(
&self,
table: &str,
column: &str,
) -> Result<(), ValidationError>
pub fn validate_column( &self, table: &str, column: &str, ) -> Result<(), ValidationError>
Check if a column exists in a table. If not, returns structured error.
Sourcepub fn validate_command(&self, cmd: &Qail) -> ValidationResult
pub fn validate_command(&self, cmd: &Qail) -> ValidationResult
Validate an entire Qail against the schema.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Validator
impl RefUnwindSafe for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl UnwindSafe for Validator
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
Mutably borrows from an owned value. Read more