pub struct CodeGenerator;Expand description
Code generation engine for creating Rust code from introspected database schema
Implementations§
Source§impl CodeGenerator
impl CodeGenerator
Sourcepub fn generate_table_definitions(
&self,
tables: &[Table],
) -> HashMap<String, String>
pub fn generate_table_definitions( &self, tables: &[Table], ) -> HashMap<String, String>
Generate table! macro definitions from introspected tables
Sourcepub fn generate_view_definitions(
&self,
views: &[View],
) -> HashMap<String, String>
pub fn generate_view_definitions( &self, views: &[View], ) -> HashMap<String, String>
Generate view! macro definitions
Sourcepub fn generate_composite_definitions(
&self,
types: &[CompositeType],
) -> HashMap<String, String>
pub fn generate_composite_definitions( &self, types: &[CompositeType], ) -> HashMap<String, String>
Generate composite type definitions with #[derive(PgComposite)]
Sourcepub fn generate_model_structs(
&self,
tables: &[Table],
) -> HashMap<String, String>
pub fn generate_model_structs( &self, tables: &[Table], ) -> HashMap<String, String>
Generate IgnisModel structs with proper derives
Sourcepub fn generate_misc_definitions(
&self,
indexes: &[Index],
roles: &[Role],
grants: &[Grant],
) -> HashMap<String, String>
pub fn generate_misc_definitions( &self, indexes: &[Index], roles: &[Role], grants: &[Grant], ) -> HashMap<String, String>
Generate index!, role!, grant! definitions
Sourcepub fn generate_module_structure(
&self,
tables: &[Table],
views: &[View],
composite_types: &[CompositeType],
indexes: &[Index],
roles: &[Role],
grants: &[Grant],
) -> HashMap<String, String>
pub fn generate_module_structure( &self, tables: &[Table], views: &[View], composite_types: &[CompositeType], indexes: &[Index], roles: &[Role], grants: &[Grant], ) -> HashMap<String, String>
Generate complete module structure
Sourcepub fn column_type_to_rust_type(&self, column_type: &ColumnType) -> String
pub fn column_type_to_rust_type(&self, column_type: &ColumnType) -> String
Convert column type to Rust type string
Sourcepub fn to_pascal_case(&self, s: &str) -> String
pub fn to_pascal_case(&self, s: &str) -> String
Convert snake_case to PascalCase
pub fn to_snake_case(&self, s: &str) -> String
Auto Trait Implementations§
impl Freeze for CodeGenerator
impl RefUnwindSafe for CodeGenerator
impl Send for CodeGenerator
impl Sync for CodeGenerator
impl Unpin for CodeGenerator
impl UnsafeUnpin for CodeGenerator
impl UnwindSafe for CodeGenerator
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more