pub struct SqliteStoreBuilder { /* private fields */ }sqlite only.Expand description
Builder for SqliteStore.
To create the database call SqliteStoreBuilder::build().
By default, the builder configures an in-memory database with a maximum number of 16 connections. The database is created if it doesn’t already exist and migrations are automatically run on start-up.
Implementations§
Source§impl SqliteStoreBuilder
impl SqliteStoreBuilder
Sourcepub fn random_memory_url(self) -> Self
Available on crate features test_utils only.
pub fn random_memory_url(self) -> Self
test_utils only.Assigns a randomly-generated in-memory database URL with private cache.
Sourcepub fn database_url(self, url: &str) -> Self
pub fn database_url(self, url: &str) -> Self
Sets the database URL.
If left unset, the database will use an ephemeral in-memory URL.
Sourcepub fn max_connections(self, max_connections: u32) -> Self
pub fn max_connections(self, max_connections: u32) -> Self
Sets the maximum number of connections to be maintained by the database pool.
If left unset, a maximum of 16 connections will be maintained.
Sourcepub fn create_database(self, create_database: bool) -> Self
pub fn create_database(self, create_database: bool) -> Self
Creates the database if it doesn’t already exist.
If left unset, the database will be created by default.
Sourcepub fn run_default_migrations(self, run_migrations: bool) -> Self
pub fn run_default_migrations(self, run_migrations: bool) -> Self
Sets whether pending migrations should be applied when the database is built.
If left unset, the database will apply any pending migrations.
Sourcepub async fn build(self) -> Result<SqliteStore, SqliteError>
pub async fn build(self) -> Result<SqliteStore, SqliteError>
Builds the SqliteStore.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SqliteStoreBuilder
impl RefUnwindSafe for SqliteStoreBuilder
impl Send for SqliteStoreBuilder
impl Sync for SqliteStoreBuilder
impl Unpin for SqliteStoreBuilder
impl UnsafeUnpin for SqliteStoreBuilder
impl UnwindSafe for SqliteStoreBuilder
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
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>
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>
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