pub struct EntityManager(pub DBPlatform);
Tuple Fields§
§0: DBPlatform
Implementations§
Source§impl EntityManager
impl EntityManager
pub fn begin_transaction(&mut self) -> Result<(), DbError>
pub fn commit_transaction(&mut self) -> Result<(), DbError>
pub fn rollback_transaction(&mut self) -> Result<(), DbError>
pub fn set_session_user(&mut self, username: &str) -> Result<(), DbError>
pub fn db(&mut self) -> &mut dyn Database
Sourcepub fn get_table(
&mut self,
table_name: &TableName,
) -> Result<Option<TableDef>, DbError>
pub fn get_table( &mut self, table_name: &TableName, ) -> Result<Option<TableDef>, DbError>
get the table from database based on this column name
Sourcepub fn set_autoincrement_value(
&mut self,
table_name: &TableName,
sequence_value: i64,
) -> Result<Option<i64>, DbError>
pub fn set_autoincrement_value( &mut self, table_name: &TableName, sequence_value: i64, ) -> Result<Option<i64>, DbError>
set the autoincrement value of the primary column(if present) of this table. If the primary column of this table is not an autoincrement, returns Ok(None).
pub fn get_autoincrement_last_value( &mut self, table_name: &TableName, ) -> Result<Option<i64>, DbError>
Sourcepub fn get_all_tables(&mut self) -> Result<Vec<TableDef>, DbError>
pub fn get_all_tables(&mut self) -> Result<Vec<TableDef>, DbError>
get all the user table and views from the database
Sourcepub fn get_total_records(
&mut self,
table_name: &TableName,
) -> Result<usize, DbError>
pub fn get_total_records( &mut self, table_name: &TableName, ) -> Result<usize, DbError>
Get the total count of records
pub fn get_database_name(&mut self) -> Result<Option<DatabaseName>, DbError>
Sourcepub fn get_grouped_tables(&mut self) -> Result<Vec<SchemaContent>, DbError>
pub fn get_grouped_tables(&mut self) -> Result<Vec<SchemaContent>, DbError>
get all table and views grouped per schema
pub fn insert<T, R>(&mut self, entities: &[&T]) -> Result<Vec<R>, DbError>
Sourcepub fn insert_bulk_with_returning_support<T, R>(
&mut self,
entities: &[&T],
) -> Result<Vec<R>, DbError>
pub fn insert_bulk_with_returning_support<T, R>( &mut self, entities: &[&T], ) -> Result<Vec<R>, DbError>
called when the platform used is postgresql
Sourcepub fn single_insert<T>(&mut self, entity: &T) -> Result<(), DbError>
pub fn single_insert<T>(&mut self, entity: &T) -> Result<(), DbError>
called multiple times when using database platform that doesn;t support multiple value insert such as sqlite
Sourcepub fn insert_simple<T, R>(
&mut self,
entities: &[&T],
) -> Result<Vec<R>, DbError>
pub fn insert_simple<T, R>( &mut self, entities: &[&T], ) -> Result<Vec<R>, DbError>
this is soly for use with sqlite since sqlite doesn’t support bulk insert
pub fn execute_sql_with_return<'a, R>(
&mut self,
sql: &str,
params: &[&'a dyn ToValue],
) -> Result<Vec<R>, DbError>where
R: FromDao,
pub fn execute_sql_with_one_return<'a, R>(
&mut self,
sql: &str,
params: &[&'a dyn ToValue],
) -> Result<R, DbError>where
R: FromDao,
pub fn execute_sql_with_maybe_one_return<'a, R>(
&mut self,
sql: &str,
params: &[&'a dyn ToValue],
) -> Result<Option<R>, DbError>where
R: FromDao,
Auto Trait Implementations§
impl Freeze for EntityManager
impl !RefUnwindSafe for EntityManager
impl Send for EntityManager
impl !Sync for EntityManager
impl Unpin for EntityManager
impl !UnwindSafe for EntityManager
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