pub struct Database {
pub migrations_dir_path: Option<String>,
pub connection_url: String,
pub max_reconnect_attempts: u32,
pub timeout_duration: Duration,
/* private fields */
}
Fields§
§migrations_dir_path: Option<String>
§connection_url: String
§max_reconnect_attempts: u32
§timeout_duration: Duration
Implementations§
Source§impl Database
impl Database
pub async fn connect(&self) -> Result<Client, PostgresError>
pub async fn migrate(&mut self) -> Result<(), Box<dyn Error>>
pub async fn rollback(&mut self) -> Result<(), Box<dyn Error>>
pub async fn rollback_full(&mut self) -> Result<(), Box<dyn Error>>
pub async fn query( &self, query: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Vec<Row>, PostgresModelError>
pub async fn query_one( &self, query: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<Row, PostgresModelError>
pub async fn execute( &self, query: &str, params: &[&(dyn ToSql + Sync)], ) -> Result<u64, PostgresModelError>
pub async fn check_connection(&self) -> Result<bool, PostgresModelError>
Auto Trait Implementations§
impl Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
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