pub struct ViewBuilder { /* private fields */ }Expand description
Builder for constructing database views
Implementations§
Source§impl ViewBuilder
impl ViewBuilder
Sourcepub fn set_name(&mut self, name: impl Into<String>)
pub fn set_name(&mut self, name: impl Into<String>)
Set the view name (mutable reference version for conditional building)
Sourcepub fn set_schema(&mut self, schema: impl Into<String>)
pub fn set_schema(&mut self, schema: impl Into<String>)
Set the schema name (mutable reference version for conditional building)
Sourcepub fn set_query(&mut self, query: impl Into<String>)
pub fn set_query(&mut self, query: impl Into<String>)
Set the view query (mutable reference version for conditional building)
Sourcepub fn add_column(&mut self, column: impl Into<String>)
pub fn add_column(&mut self, column: impl Into<String>)
Add a column definition to the view (mutable reference version for conditional building)
Sourcepub fn columns(
self,
columns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn columns( self, columns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Add multiple column definitions to the view
Sourcepub fn add_columns(
&mut self,
columns: impl IntoIterator<Item = impl Into<String>>,
)
pub fn add_columns( &mut self, columns: impl IntoIterator<Item = impl Into<String>>, )
Add multiple column definitions to the view (mutable reference version for conditional building)
Sourcepub fn materialized(self) -> Self
pub fn materialized(self) -> Self
Make the view materialized
Sourcepub fn set_materialized(&mut self)
pub fn set_materialized(&mut self)
Make the view materialized (mutable reference version for conditional building)
Sourcepub fn set_with_data(&mut self)
pub fn set_with_data(&mut self)
Set the view to be created with data (mutable reference version for conditional building)
Sourcepub fn check_option(self, option: impl Into<String>) -> Self
pub fn check_option(self, option: impl Into<String>) -> Self
Set the check option for updatable views
Sourcepub fn set_check_option(&mut self, option: impl Into<String>)
pub fn set_check_option(&mut self, option: impl Into<String>)
Set the check option for updatable views (mutable reference version for conditional building)
Sourcepub fn set_comment(&mut self, comment: impl Into<String>)
pub fn set_comment(&mut self, comment: impl Into<String>)
Set a comment on the view (mutable reference version for conditional building)
Sourcepub fn materialized_view() -> Self
pub fn materialized_view() -> Self
Create a materialized view
Sourcepub fn with_check_option(option: impl Into<String>) -> Self
pub fn with_check_option(option: impl Into<String>) -> Self
Create a view with check option
Sourcepub fn with_local_check() -> Self
pub fn with_local_check() -> Self
Create a view with local check option
Sourcepub fn with_cascaded_check() -> Self
pub fn with_cascaded_check() -> Self
Create a view with cascaded check option
Sourcepub fn from_table(table_name: impl Into<String>) -> Self
pub fn from_table(table_name: impl Into<String>) -> Self
Create a view from a table
Sourcepub fn from_table_columns(
table_name: impl Into<String>,
columns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn from_table_columns( table_name: impl Into<String>, columns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Create a view from a table with specific columns
Sourcepub fn with_join(
table1: impl Into<String>,
table2: impl Into<String>,
join_condition: impl Into<String>,
) -> Self
pub fn with_join( table1: impl Into<String>, table2: impl Into<String>, join_condition: impl Into<String>, ) -> Self
Create a view with a JOIN
Sourcepub fn with_aggregation(
table_name: impl Into<String>,
group_by: impl Into<String>,
aggregates: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_aggregation( table_name: impl Into<String>, group_by: impl Into<String>, aggregates: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Create a view with aggregation
Sourcepub fn get_schema(&self) -> Option<&str>
pub fn get_schema(&self) -> Option<&str>
Get the schema name
Sourcepub fn get_columns(&self) -> &[String]
pub fn get_columns(&self) -> &[String]
Get the column definitions
Sourcepub fn is_materialized(&self) -> bool
pub fn is_materialized(&self) -> bool
Check if the view is materialized
Sourcepub fn is_with_data(&self) -> bool
pub fn is_with_data(&self) -> bool
Check if the view is created with data
Sourcepub fn get_check_option(&self) -> Option<&str>
pub fn get_check_option(&self) -> Option<&str>
Get the check option
Sourcepub fn get_comment(&self) -> Option<&str>
pub fn get_comment(&self) -> Option<&str>
Get the comment
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Get the number of columns in the view
Sourcepub fn has_column(&self, column_name: &str) -> bool
pub fn has_column(&self, column_name: &str) -> bool
Check if the view has a specific column
Sourcepub fn has_schema(&self) -> bool
pub fn has_schema(&self) -> bool
Check if the view has a schema
Sourcepub fn has_check_option(&self) -> bool
pub fn has_check_option(&self) -> bool
Check if the view has a check option
Sourcepub fn has_comment(&self) -> bool
pub fn has_comment(&self) -> bool
Check if the view has a comment
Trait Implementations§
Source§impl Clone for ViewBuilder
impl Clone for ViewBuilder
Source§fn clone(&self) -> ViewBuilder
fn clone(&self) -> ViewBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ConditionalBuilder for ViewBuilder
impl ConditionalBuilder for ViewBuilder
Source§impl Debug for ViewBuilder
impl Debug for ViewBuilder
Source§impl InspectableBuilder for ViewBuilder
impl InspectableBuilder for ViewBuilder
Source§impl SchemaBuilder for ViewBuilder
impl SchemaBuilder for ViewBuilder
Source§impl ValidatableBuilder for ViewBuilder
impl ValidatableBuilder for ViewBuilder
Auto Trait Implementations§
impl Freeze for ViewBuilder
impl RefUnwindSafe for ViewBuilder
impl Send for ViewBuilder
impl Sync for ViewBuilder
impl Unpin for ViewBuilder
impl UnsafeUnpin for ViewBuilder
impl UnwindSafe for ViewBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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