pub enum DBImpl {
SQLite,
Postgres,
MySQL,
}
Expand description
The main interface for creating sql strings
Variants§
SQLite
Available on crate feature
sqlite
only.Implementation of SQLite
Postgres
Available on crate feature
postgres
only.Implementation of Postgres
MySQL
Available on crate feature
mysql
only.Implementation of MySQL / MariaDB
Implementations§
Source§impl DBImpl
impl DBImpl
Sourcepub fn create_table<'until_build, 'post_build>(
&self,
name: &'until_build str,
) -> impl CreateTable<'until_build, 'post_build>where
'post_build: 'until_build,
pub fn create_table<'until_build, 'post_build>(
&self,
name: &'until_build str,
) -> impl CreateTable<'until_build, 'post_build>where
'post_build: 'until_build,
The entry point to create a table.
Parameter:
name
: Name of the table
Sourcepub fn create_trigger(
&self,
name: &str,
table_name: &str,
point_in_time: Option<SQLCreateTriggerPointInTime>,
operation: SQLCreateTriggerOperation,
) -> SQLCreateTrigger
pub fn create_trigger( &self, name: &str, table_name: &str, point_in_time: Option<SQLCreateTriggerPointInTime>, operation: SQLCreateTriggerOperation, ) -> SQLCreateTrigger
The entry point to create a trigger.
Parameter:
name
: Name of the trigger.table_name
: Name of the table to create the trigger on.point_in_time
: Option of SQLCreateTriggerPointInTime: When to execute the trigger.operation
: SQLCreateTriggerOperation: The operation that invokes the trigger.
Sourcepub fn create_index<'until_build>(
&self,
name: &'until_build str,
table_name: &'until_build str,
) -> impl CreateIndex<'until_build>
pub fn create_index<'until_build>( &self, name: &'until_build str, table_name: &'until_build str, ) -> impl CreateIndex<'until_build>
The entry point to create an index.
Parameter:
name
: Name of the index.table_name
: Table to create the index on.
Sourcepub fn drop_table<'until_build>(
&self,
name: &'until_build str,
) -> impl DropTable + 'until_build
pub fn drop_table<'until_build>( &self, name: &'until_build str, ) -> impl DropTable + 'until_build
The entry point to drop a table.
Parameter:
name
: Name of the table to drop.
Sourcepub fn alter_table<'until_build, 'post_build>(
&self,
name: &'until_build str,
operation: AlterTableOperation<'until_build, 'post_build>,
) -> impl AlterTable<'post_build> + 'until_buildwhere
'post_build: 'until_build,
pub fn alter_table<'until_build, 'post_build>(
&self,
name: &'until_build str,
operation: AlterTableOperation<'until_build, 'post_build>,
) -> impl AlterTable<'post_build> + 'until_buildwhere
'post_build: 'until_build,
The entry point to alter a table.
Parameter:
name
: Name of the table to execute the operation on.operation
: AlterTableOperation: The operation to execute.
Sourcepub fn create_column<'until_build, 'post_build>(
&self,
table_name: &'until_build str,
name: &'until_build str,
data_type: DbType,
annotations: &'post_build [Annotation],
) -> CreateColumnImpl<'until_build, 'post_build>
pub fn create_column<'until_build, 'post_build>( &self, table_name: &'until_build str, name: &'until_build str, data_type: DbType, annotations: &'post_build [Annotation], ) -> CreateColumnImpl<'until_build, 'post_build>
The entry point to create a column in a table.
Parameter:
table_name
: Name of the table.name
: Name of the column.data_type
: DbType: Data type of the columnannotations
: slice of Annotation: List of annotations.
Sourcepub fn select<'until_build, 'post_build>(
&self,
columns: &'until_build [SelectColumnImpl<'_>],
from_clause: &'until_build str,
joins: &'until_build [JoinTableImpl<'until_build, 'post_build>],
order_by_clause: &'until_build [OrderByEntry<'until_build>],
) -> impl Select<'until_build, 'post_build>
pub fn select<'until_build, 'post_build>( &self, columns: &'until_build [SelectColumnImpl<'_>], from_clause: &'until_build str, joins: &'until_build [JoinTableImpl<'until_build, 'post_build>], order_by_clause: &'until_build [OrderByEntry<'until_build>], ) -> impl Select<'until_build, 'post_build>
Build a select query.
Parameter:
columns
: The columns to select.from_clause
: Specifies from what to select. This can be a table name or another query itself.joins
: List of join tables.
Sourcepub fn insert<'until_build, 'post_build>(
&self,
into_clause: &'until_build str,
insert_columns: &'until_build [&'until_build str],
insert_values: &'until_build [&'until_build [Value<'post_build>]],
returning_clause: Option<&'until_build [&'until_build str]>,
) -> impl Insert<'post_build> + 'until_buildwhere
'post_build: 'until_build,
pub fn insert<'until_build, 'post_build>(
&self,
into_clause: &'until_build str,
insert_columns: &'until_build [&'until_build str],
insert_values: &'until_build [&'until_build [Value<'post_build>]],
returning_clause: Option<&'until_build [&'until_build str]>,
) -> impl Insert<'post_build> + 'until_buildwhere
'post_build: 'until_build,
Build an INSERT query.
Parameter:
into_clause
: The table to insert into.insert_columns
: The column names to insert into.insert_values
: slice of slice of Value: The values to insert.returning_clause
: Optional slice of string to retrieve after the insert.
Sourcepub fn delete<'until_build, 'post_query>(
&self,
table_name: &'until_build str,
) -> impl Delete<'until_build, 'post_query>where
'post_query: 'until_build,
pub fn delete<'until_build, 'post_query>(
&self,
table_name: &'until_build str,
) -> impl Delete<'until_build, 'post_query>where
'post_query: 'until_build,
Build a delete operation.
Parameter:
table_name
: Name of the table to delete from.
Sourcepub fn update<'until_build, 'post_query>(
&self,
table_name: &'until_build str,
) -> impl Update<'until_build, 'post_query>where
'post_query: 'until_build,
pub fn update<'until_build, 'post_query>(
&self,
table_name: &'until_build str,
) -> impl Update<'until_build, 'post_query>where
'post_query: 'until_build,
Build an update operation.
Parameter:
table_name
: Name of the table the updates should be executed for.
Sourcepub fn join_table<'until_build, 'post_query>(
&self,
join_type: JoinType,
table_name: &'until_build str,
join_alias: &'until_build str,
join_condition: Cow<'until_build, Condition<'post_query>>,
) -> JoinTableImpl<'until_build, 'post_query>
pub fn join_table<'until_build, 'post_query>( &self, join_type: JoinType, table_name: &'until_build str, join_alias: &'until_build str, join_condition: Cow<'until_build, Condition<'post_query>>, ) -> JoinTableImpl<'until_build, 'post_query>
Sourcepub fn select_column<'until_build>(
&self,
table_name: Option<&'until_build str>,
column_name: &'until_build str,
select_alias: Option<&'until_build str>,
aggregation: Option<SelectAggregator>,
) -> SelectColumnImpl<'until_build>
pub fn select_column<'until_build>( &self, table_name: Option<&'until_build str>, column_name: &'until_build str, select_alias: Option<&'until_build str>, aggregation: Option<SelectAggregator>, ) -> SelectColumnImpl<'until_build>
The entry point for a column selector builder.
Parameter:
table_name
: Optional table namecolumn_name
: Name of the columnselect_alias
: Alias for the selectoraggregation
: Optional aggregation function
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DBImpl
impl RefUnwindSafe for DBImpl
impl Send for DBImpl
impl Sync for DBImpl
impl Unpin for DBImpl
impl UnwindSafe for DBImpl
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