pub struct PostgresDb { /* private fields */ }Expand description
The store’s driver over a Postgres pool. Values go in the statement’s text as literals of unknown type, so Postgres infers each one’s type as it does for node-postgres’s untyped parameters.
Implementations§
Source§impl PostgresDb
impl PostgresDb
Sourcepub fn new(pool: PgPool) -> PostgresDb
pub fn new(pool: PgPool) -> PostgresDb
The store’s driver over a pool.
Trait Implementations§
Source§impl Clone for PostgresDb
impl Clone for PostgresDb
Source§impl Db for PostgresDb
impl Db for PostgresDb
Source§fn all<'a>(
&'a self,
sql: &'a str,
params: Vec<Param>,
) -> BoxFuture<'a, Result<Vec<Row>, DbError>>
fn all<'a>( &'a self, sql: &'a str, params: Vec<Param>, ) -> BoxFuture<'a, Result<Vec<Row>, DbError>>
Runs a query and gives its rows.
Source§fn run<'a>(
&'a self,
sql: &'a str,
params: Vec<Param>,
) -> BoxFuture<'a, Result<u64, DbError>>
fn run<'a>( &'a self, sql: &'a str, params: Vec<Param>, ) -> BoxFuture<'a, Result<u64, DbError>>
Runs a statement and says how many rows it matched.
Source§fn hold(&self, kind: Hold) -> BoxFuture<'_, Result<Arc<dyn Db>, DbError>>
fn hold(&self, kind: Hold) -> BoxFuture<'_, Result<Arc<dyn Db>, DbError>>
One connection, held for a transaction or a lock until
finish. Statements on it run in
turn with nothing else of the store’s in between. Holding a transaction on a connection
already in one joins it.Source§fn finish(
&self,
_ok: bool,
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + '_>>
fn finish( &self, _ok: bool, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + '_>>
Ends what
hold began: commits a transaction (ok) or rolls it back, or lets go of a lock.
A connection that was not held answers Ok.Auto Trait Implementations§
impl !RefUnwindSafe for PostgresDb
impl !UnwindSafe for PostgresDb
impl Freeze for PostgresDb
impl Send for PostgresDb
impl Sync for PostgresDb
impl Unpin for PostgresDb
impl UnsafeUnpin for PostgresDb
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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