Skip to main content

DefaultIndexGenerator

Struct DefaultIndexGenerator 

Source
pub struct DefaultIndexGenerator { /* private fields */ }

Implementations§

Source§

impl DefaultIndexGenerator

Source

pub fn new(context: GeneratorContext) -> Self

Source

pub fn context(&self) -> &GeneratorContext

Source§

impl DefaultIndexGenerator

Source

pub fn output_indexes_via(&self, generator: &dyn IndexGenerator)

Same iteration logic as output_indexes, but dispatches each table (and, transitively, each index) through generator rather than self - see DefaultFunctionGenerator::output_functions_via for why: a dialect wrapper (e.g. SqlServerIndexGenerator) that overrides index_options but delegates output_indexes straight to this struct would otherwise never see its own override invoked, because Rust has no virtual dispatch on concrete types. Callers that need their override honored should pass self (as a &dyn IndexGenerator) here instead of calling output_indexes directly.

Source

pub fn output_indexes_for_table_via( &self, generator: &dyn IndexGenerator, writer: &mut SqlWriter, table: &Table, )

Same as output_indexes_via, one table at a time - see that method for why dispatching through generator (rather than calling self.output_index directly) matters.

Source

pub fn render_index( &self, writer: &mut SqlWriter, statement_separator: &str, table: &Table, key_name: &str, key: &Key, index_options: Option<String>, )

Renders one create index statement given an already-computed index_options - shared by DefaultIndexGenerator::output_index and every dialect override, so each only has to supply its own index_options before calling back into this.

Trait Implementations§

Source§

impl IndexGenerator for DefaultIndexGenerator

Source§

fn output_indexes(&self)

Source§

fn output_indexes_for_table(&self, writer: &mut SqlWriter, table: &Table)

Source§

fn output_index( &self, writer: &mut SqlWriter, statement_separator: &str, table: &Table, key_name: &str, key: &Key, )

Source§

fn index_options(&self, _key: &Key) -> Option<String>

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.