Struct clia_rustorm::EntityManager
source · [−]pub struct EntityManager(pub DBPlatform);
Tuple Fields
0: DBPlatform
Implementations
sourceimpl 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_all<T>(&mut self) -> Result<Vec<T>, DbError>where
T: ToTableName + ToColumnNames + FromDao,
pub fn get_all<T>(&mut self) -> Result<Vec<T>, DbError>where
T: ToTableName + ToColumnNames + FromDao,
get all the records of this table
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>where
T: ToTableName + ToColumnNames + ToDao,
R: FromDao + ToColumnNames,
sourcepub fn insert_bulk_with_returning_support<T, R>(
&mut self,
entities: &[&T]
) -> Result<Vec<R>, DbError>where
T: ToTableName + ToColumnNames + ToDao,
R: FromDao + ToColumnNames,
pub fn insert_bulk_with_returning_support<T, R>(
&mut self,
entities: &[&T]
) -> Result<Vec<R>, DbError>where
T: ToTableName + ToColumnNames + ToDao,
R: FromDao + ToColumnNames,
called when the platform used is postgresql
sourcepub fn single_insert<T>(&mut self, entity: &T) -> Result<(), DbError>where
T: ToTableName + ToColumnNames + ToDao,
pub fn single_insert<T>(&mut self, entity: &T) -> Result<(), DbError>where
T: ToTableName + ToColumnNames + ToDao,
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>where
T: ToTableName + ToColumnNames + ToDao,
R: FromDao + ToColumnNames,
pub fn insert_simple<T, R>(&mut self, entities: &[&T]) -> Result<Vec<R>, DbError>where
T: ToTableName + ToColumnNames + ToDao,
R: FromDao + ToColumnNames,
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 raw_execute_sql_with_return(
&mut self,
sql: &str,
params: &[&Value]
) -> Result<Rows, DbError>
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 !RefUnwindSafe for EntityManager
impl Send for EntityManager
impl !Sync for EntityManager
impl Unpin for EntityManager
impl !UnwindSafe for EntityManager
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more