Struct EntityManager

Source
pub struct EntityManager(pub DBPlatform);

Tuple Fields§

§0: DBPlatform

Implementations§

Source§

impl EntityManager

Source

pub fn begin_transaction(&mut self) -> Result<(), DbError>

Source

pub fn commit_transaction(&mut self) -> Result<(), DbError>

Source

pub fn rollback_transaction(&mut self) -> Result<(), DbError>

Source

pub fn set_session_user(&mut self, username: &str) -> Result<(), DbError>

Source

pub fn db(&mut self) -> &mut dyn Database

Source

pub fn get_all<T>(&mut self) -> Result<Vec<T>, DbError>

get all the records of this table

Source

pub fn get_table( &mut self, table_name: &TableName, ) -> Result<Option<TableDef>, DbError>

get the table from database based on this column name

Source

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).

Source

pub fn get_autoincrement_last_value( &mut self, table_name: &TableName, ) -> Result<Option<i64>, DbError>

Source

pub fn get_all_tables(&mut self) -> Result<Vec<TableDef>, DbError>

get all the user table and views from the database

Source

pub fn get_tablenames(&mut self) -> Result<Vec<TableName>, DbError>

get all the tablenames

Source

pub fn get_total_records( &mut self, table_name: &TableName, ) -> Result<usize, DbError>

Get the total count of records

Source

pub fn get_database_name(&mut self) -> Result<Option<DatabaseName>, DbError>

Source

pub fn get_grouped_tables(&mut self) -> Result<Vec<SchemaContent>, DbError>

get all table and views grouped per schema

Source

pub fn insert<T, R>(&mut self, entities: &[&T]) -> Result<Vec<R>, DbError>

Source

pub fn insert_bulk_with_returning_support<T, R>( &mut self, entities: &[&T], ) -> Result<Vec<R>, DbError>

called when the platform used is postgresql

Source

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

Source

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

Source

pub fn execute_sql_with_return<'a, R>( &mut self, sql: &str, params: &[&'a dyn ToValue], ) -> Result<Vec<R>, DbError>
where R: FromDao,

Source

pub fn execute_sql_with_one_return<'a, R>( &mut self, sql: &str, params: &[&'a dyn ToValue], ) -> Result<R, DbError>
where R: FromDao,

Source

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§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

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