pub struct PostgresConnection { /* private fields */ }Expand description
PostgreSQL connection
Implementations§
Source§impl PostgresConnection
impl PostgresConnection
Sourcepub async fn connect(connection_string: &str) -> DatabaseResult<Self>
pub async fn connect(connection_string: &str) -> DatabaseResult<Self>
Connect to a PostgreSQL database
Sourcepub async fn execute(&self, query: &str) -> DatabaseResult<Recordset>
pub async fn execute(&self, query: &str) -> DatabaseResult<Recordset>
Execute a SELECT query
Sourcepub async fn execute_command(&self, command: &str) -> DatabaseResult<u64>
pub async fn execute_command(&self, command: &str) -> DatabaseResult<u64>
Execute a command (INSERT, UPDATE, DELETE)
Sourcepub async fn close(&mut self) -> DatabaseResult<()>
pub async fn close(&mut self) -> DatabaseResult<()>
Close the connection
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if connection is alive
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PostgresConnection
impl !RefUnwindSafe for PostgresConnection
impl Send for PostgresConnection
impl Sync for PostgresConnection
impl Unpin for PostgresConnection
impl !UnwindSafe for PostgresConnection
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more