pub struct DatabaseBuilder { /* private fields */ }Expand description
Connection and pool configuration shared by SQL backends.
Implementations§
Source§impl DatabaseBuilder
impl DatabaseBuilder
Sourcepub fn max_connections(self, maximum: usize) -> Self
pub fn max_connections(self, maximum: usize) -> Self
Set the maximum number of pooled connections.
Sourcepub fn table_prefix(self, prefix: &str) -> Self
pub fn table_prefix(self, prefix: &str) -> Self
Set a prefix for every model table managed by Toasty.
Sourcepub async fn connect(self, url: &str) -> Result<Database, DatabaseError>
pub async fn connect(self, url: &str) -> Result<Database, DatabaseError>
Connect using a sqlite:, postgresql:, or mysql: URL.
§Errors
Returns an error for unsupported URLs or failed database connections.
Sourcepub async fn sqlite_memory(self) -> Result<Database, DatabaseError>
pub async fn sqlite_memory(self) -> Result<Database, DatabaseError>
Build an isolated in-memory SQLite database.
§Errors
Returns an error when the SQLite driver cannot initialize.
Auto Trait Implementations§
impl Freeze for DatabaseBuilder
impl RefUnwindSafe for DatabaseBuilder
impl Send for DatabaseBuilder
impl Sync for DatabaseBuilder
impl Unpin for DatabaseBuilder
impl UnsafeUnpin for DatabaseBuilder
impl UnwindSafe for DatabaseBuilder
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