pub struct SqlErrorContext {
pub query: String,
pub error_position: Option<usize>,
pub error_line: usize,
pub error_column: usize,
pub suggestion: Option<String>,
pub available_tables: Vec<String>,
pub available_columns: Vec<String>,
}Expand description
Enhanced error with SQL context and suggestions
Fields§
§query: String§error_position: Option<usize>§error_line: usize§error_column: usize§suggestion: Option<String>§available_tables: Vec<String>§available_columns: Vec<String>Implementations§
Source§impl SqlErrorContext
impl SqlErrorContext
Sourcepub fn from_query(query: &str, error: &str) -> Self
pub fn from_query(query: &str, error: &str) -> Self
Create error context from a query and error message
Sourcepub fn with_schema_info(self, tables: Vec<String>, columns: Vec<String>) -> Self
pub fn with_schema_info(self, tables: Vec<String>, columns: Vec<String>) -> Self
Add available tables and columns for better suggestions
Sourcepub fn find_similar_names(&self, name: &str) -> Vec<String>
pub fn find_similar_names(&self, name: &str) -> Vec<String>
Find similar table/column names using Levenshtein distance
Trait Implementations§
Source§impl Clone for SqlErrorContext
impl Clone for SqlErrorContext
Source§fn clone(&self) -> SqlErrorContext
fn clone(&self) -> SqlErrorContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SqlErrorContext
impl Debug for SqlErrorContext
Auto Trait Implementations§
impl Freeze for SqlErrorContext
impl RefUnwindSafe for SqlErrorContext
impl Send for SqlErrorContext
impl Sync for SqlErrorContext
impl Unpin for SqlErrorContext
impl UnsafeUnpin for SqlErrorContext
impl UnwindSafe for SqlErrorContext
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