pub struct SqliteConnectionPool { /* private fields */ }Available on crate feature
sqlite only.Implementations§
Source§impl SqliteConnectionPool
impl SqliteConnectionPool
Sourcepub async fn new(
path: &str,
mode: Mode,
join_push_down: JoinPushDown,
attach_databases: Vec<Arc<str>>,
busy_timeout: Duration,
) -> Result<Self, Error>
pub async fn new( path: &str, mode: Mode, join_push_down: JoinPushDown, attach_databases: Vec<Arc<str>>, busy_timeout: Duration, ) -> Result<Self, Error>
Creates a new instance of SqliteConnectionPool.
NOTE: The SqliteConnectionPool currently does no connection pooling, it simply creates a new connection
and clones it on each call to connect().
§Errors
Returns an error if there is a problem creating the connection pool.
Sourcepub async fn init(path: &str, mode: Mode) -> Result<(), Error>
pub async fn init(path: &str, mode: Mode) -> Result<(), Error>
Initializes an SQLite database on-disk without creating a connection pool. No-op if the database is in-memory.
pub async fn setup(&self) -> Result<(), Error>
pub fn connect_sync( &self, ) -> Box<dyn DbConnection<Connection, &'static (dyn ToSql + Sync)>>
Sourcepub async fn try_clone(&self) -> Result<Self, Error>
pub async fn try_clone(&self) -> Result<Self, Error>
Will attempt to clone the connection pool. This will always succeed for in-memory mode. For file-mode, it will attempt to create a new connection pool with the same configuration.
Due to the way the connection pool is implemented, it doesn’t allow multiple concurrent reads/writes using the same connection pool instance.
Trait Implementations§
Source§impl DbConnectionPool<Connection, &'static (dyn ToSql + Sync)> for SqliteConnectionPool
impl DbConnectionPool<Connection, &'static (dyn ToSql + Sync)> for SqliteConnectionPool
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn DbConnection<Connection, &'static (dyn ToSql + Sync)>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn join_push_down(&self) -> JoinPushDown
Auto Trait Implementations§
impl Freeze for SqliteConnectionPool
impl RefUnwindSafe for SqliteConnectionPool
impl Send for SqliteConnectionPool
impl Sync for SqliteConnectionPool
impl Unpin for SqliteConnectionPool
impl UnwindSafe for SqliteConnectionPool
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request