pub struct ExtractorOptions<'a> {
pub catalog: Option<&'a Catalog>,
pub casing: Option<IdentifierCasing>,
}Expand description
Optional inputs shared by every *_with_options extractor. Defaults
to no catalog and the dialect-derived identifier casing — i.e. the
plain extract_*(dialect, sql) behaviour.
use sql_insight::sqlparser::dialect::GenericDialect;
use sql_insight::extractor::{extract_table_operations_with_options, ExtractorOptions};
use sql_insight::{CaseRule, IdentifierCasing};
let dialect = GenericDialect {};
let options = ExtractorOptions::new().with_casing(IdentifierCasing::uniform(CaseRule::Sensitive));
let result = extract_table_operations_with_options(&dialect, "SELECT * FROM users", options).unwrap();
assert_eq!(result[0].as_ref().unwrap().reads.len(), 1);Fields§
§catalog: Option<&'a Catalog>The schema to resolve against. With a catalog, matched tables are canonicalized to their registered path and column resolution is strict; without one (the default), references stay as written and resolution is inferred.
casing: Option<IdentifierCasing>Override the dialect-derived identifier casing. None (the
default) derives it from the dialect via
IdentifierCasing::for_dialect — set this to model a
deployment-specific collation.
Implementations§
Source§impl<'a> ExtractorOptions<'a>
impl<'a> ExtractorOptions<'a>
Sourcepub fn with_catalog(self, catalog: &'a Catalog) -> Self
pub fn with_catalog(self, catalog: &'a Catalog) -> Self
Resolve against catalog.
Sourcepub fn with_casing(self, casing: IdentifierCasing) -> Self
pub fn with_casing(self, casing: IdentifierCasing) -> Self
Override the identifier casing (otherwise derived from the dialect).
Trait Implementations§
Source§impl<'a> Clone for ExtractorOptions<'a>
impl<'a> Clone for ExtractorOptions<'a>
Source§fn clone(&self) -> ExtractorOptions<'a>
fn clone(&self) -> ExtractorOptions<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for ExtractorOptions<'a>
impl<'a> Debug for ExtractorOptions<'a>
Source§impl<'a> Default for ExtractorOptions<'a>
impl<'a> Default for ExtractorOptions<'a>
Source§fn default() -> ExtractorOptions<'a>
fn default() -> ExtractorOptions<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for ExtractorOptions<'a>
impl<'a> RefUnwindSafe for ExtractorOptions<'a>
impl<'a> Send for ExtractorOptions<'a>
impl<'a> Sync for ExtractorOptions<'a>
impl<'a> Unpin for ExtractorOptions<'a>
impl<'a> UnsafeUnpin for ExtractorOptions<'a>
impl<'a> UnwindSafe for ExtractorOptions<'a>
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