Skip to main content

ViewBuilder

Struct ViewBuilder 

Source
pub struct ViewBuilder { /* private fields */ }
Expand description

Builder for constructing database views

Implementations§

Source§

impl ViewBuilder

Source

pub fn new() -> Self

Create a new view builder

Source

pub fn name(self, name: impl Into<String>) -> Self

Set the view name

Source

pub fn set_name(&mut self, name: impl Into<String>)

Set the view name (mutable reference version for conditional building)

Source

pub fn in_schema(self, schema: impl Into<String>) -> Self

Set the schema name

Source

pub fn set_schema(&mut self, schema: impl Into<String>)

Set the schema name (mutable reference version for conditional building)

Source

pub fn query(self, query: impl Into<String>) -> Self

Set the view query

Source

pub fn set_query(&mut self, query: impl Into<String>)

Set the view query (mutable reference version for conditional building)

Source

pub fn column(self, column: impl Into<String>) -> Self

Add a column definition to the view

Source

pub fn add_column(&mut self, column: impl Into<String>)

Add a column definition to the view (mutable reference version for conditional building)

Source

pub fn columns( self, columns: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Add multiple column definitions to the view

Source

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)

Source

pub fn materialized(self) -> Self

Make the view materialized

Source

pub fn set_materialized(&mut self)

Make the view materialized (mutable reference version for conditional building)

Source

pub fn with_data(self) -> Self

Set the view to be created with data (for materialized views)

Source

pub fn set_with_data(&mut self)

Set the view to be created with data (mutable reference version for conditional building)

Source

pub fn check_option(self, option: impl Into<String>) -> Self

Set the check option for updatable views

Source

pub fn set_check_option(&mut self, option: impl Into<String>)

Set the check option for updatable views (mutable reference version for conditional building)

Source

pub fn comment(self, comment: impl Into<String>) -> Self

Set a comment on the view

Source

pub fn set_comment(&mut self, comment: impl Into<String>)

Set a comment on the view (mutable reference version for conditional building)

Source

pub fn simple() -> Self

Create a simple view

Source

pub fn materialized_view() -> Self

Create a materialized view

Source

pub fn with_check_option(option: impl Into<String>) -> Self

Create a view with check option

Source

pub fn with_local_check() -> Self

Create a view with local check option

Source

pub fn with_cascaded_check() -> Self

Create a view with cascaded check option

Source

pub fn from_table(table_name: impl Into<String>) -> Self

Create a view from a table

Source

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

Source

pub fn with_join( table1: impl Into<String>, table2: impl Into<String>, join_condition: impl Into<String>, ) -> Self

Create a view with a JOIN

Source

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

Source

pub fn get_name(&self) -> Option<&str>

Get the view name

Source

pub fn get_schema(&self) -> Option<&str>

Get the schema name

Source

pub fn get_query(&self) -> Option<&str>

Get the view query

Source

pub fn get_columns(&self) -> &[String]

Get the column definitions

Source

pub fn is_materialized(&self) -> bool

Check if the view is materialized

Source

pub fn is_with_data(&self) -> bool

Check if the view is created with data

Source

pub fn get_check_option(&self) -> Option<&str>

Get the check option

Source

pub fn get_comment(&self) -> Option<&str>

Get the comment

Source

pub fn column_count(&self) -> usize

Get the number of columns in the view

Source

pub fn has_column(&self, column_name: &str) -> bool

Check if the view has a specific column

Source

pub fn has_name(&self) -> bool

Check if the view has a name

Source

pub fn has_schema(&self) -> bool

Check if the view has a schema

Source

pub fn has_query(&self) -> bool

Check if the view has a query

Source

pub fn has_check_option(&self) -> bool

Check if the view has a check option

Source

pub fn has_comment(&self) -> bool

Check if the view has a comment

Trait Implementations§

Source§

impl Clone for ViewBuilder

Source§

fn clone(&self) -> ViewBuilder

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 ConditionalBuilder for ViewBuilder

Source§

fn when<F>(self, condition: bool, config_fn: F) -> Self
where F: FnOnce(&mut Self), Self: Sized,

Apply configuration conditionally Read more
Source§

fn when_else<F, G>(self, condition: bool, if_true: F, if_false: G) -> Self
where F: FnOnce(&mut Self), G: FnOnce(&mut Self), Self: Sized,

Apply configuration conditionally with a default fallback Read more
Source§

impl Debug for ViewBuilder

Source§

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

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

impl InspectableBuilder for ViewBuilder

Source§

fn debug_info(&self) -> String

Get a debug representation of the current builder state Read more
Source§

fn summary(&self) -> String

Get a summary of the current configuration Read more
Source§

impl SchemaBuilder for ViewBuilder

Source§

type Output = View

The type of schema object that this builder produces
Source§

type Error = ViewBuildError

The type of error that can occur during building
Source§

fn build(self) -> Result<Self::Output, Self::Error>

Build the final schema object from the builder configuration Read more
Source§

impl ValidatableBuilder for ViewBuilder

Source§

fn is_valid(&self) -> bool

Check if the current builder configuration is valid Read more
Source§

fn validation_errors(&self) -> Vec<String>

Get a list of validation errors for the current configuration Read more

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> 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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more