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: DurationImplementations§
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 !RefUnwindSafe for Database
impl !UnwindSafe for Database
impl Freeze for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnsafeUnpin 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