pub struct Pool<DB: Database> { /* private fields */ }Expand description
A connection pool wrapping sqlx::Pool.
Generic over DB: sqlx::Database so that the same API works with
SQLite, PostgreSQL, and MySQL while retaining compile-time type safety.
Implementations§
Source§impl<DB: Database> Pool<DB>
impl<DB: Database> Pool<DB>
Sourcepub async fn connect(url: &str) -> Result<Self, FletchError>
pub async fn connect(url: &str) -> Result<Self, FletchError>
Connect to the database at the given URL.
This creates a connection pool with SQLx’s default pool options.
Sourcepub fn builder() -> PoolBuilder<DB>
pub fn builder() -> PoolBuilder<DB>
Returns a PoolBuilder for configuring pool options before connecting.
Sourcepub fn inner(&self) -> &Pool<DB>
pub fn inner(&self) -> &Pool<DB>
Returns a reference to the underlying sqlx pool.
Escape hatch for advanced or raw SQLx access. Prefer fletch CRUD and the query builder where possible.
Sourcepub async fn begin(&self) -> Result<Transaction<'static, DB>, FletchError>
pub async fn begin(&self) -> Result<Transaction<'static, DB>, FletchError>
Begin a new transaction.
Trait Implementations§
Auto Trait Implementations§
impl<DB> !RefUnwindSafe for Pool<DB>
impl<DB> !UnwindSafe for Pool<DB>
impl<DB> Freeze for Pool<DB>
impl<DB> Send for Pool<DB>
impl<DB> Sync for Pool<DB>
impl<DB> Unpin for Pool<DB>
impl<DB> UnsafeUnpin for Pool<DB>
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