Skip to main content

ExtractorOptions

Struct ExtractorOptions 

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

Source

pub fn new() -> Self

Default options: no catalog, dialect-derived casing.

Source

pub fn with_catalog(self, catalog: &'a Catalog) -> Self

Resolve against catalog.

Source

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>

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ExtractorOptions<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for ExtractorOptions<'a>

Source§

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.