pub struct DatabaseBackendRegistry { /* private fields */ }Expand description
Database backend registry for managing multiple backend implementations
Implementations§
Source§impl DatabaseBackendRegistry
impl DatabaseBackendRegistry
Sourcepub fn register(
&mut self,
backend_type: DatabaseBackendType,
backend: Arc<dyn DatabaseBackend>,
)
pub fn register( &mut self, backend_type: DatabaseBackendType, backend: Arc<dyn DatabaseBackend>, )
Register a database backend
Sourcepub fn get(
&self,
backend_type: &DatabaseBackendType,
) -> Option<Arc<dyn DatabaseBackend>>
pub fn get( &self, backend_type: &DatabaseBackendType, ) -> Option<Arc<dyn DatabaseBackend>>
Get a database backend by type
Sourcepub async fn create_pool(
&self,
database_url: &str,
config: DatabasePoolConfig,
) -> OrmResult<Arc<dyn DatabasePool>>
pub async fn create_pool( &self, database_url: &str, config: DatabasePoolConfig, ) -> OrmResult<Arc<dyn DatabasePool>>
Create a connection pool using the appropriate backend for the given URL
Sourcepub fn registered_backends(&self) -> Vec<DatabaseBackendType>
pub fn registered_backends(&self) -> Vec<DatabaseBackendType>
List all registered backend types
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DatabaseBackendRegistry
impl !RefUnwindSafe for DatabaseBackendRegistry
impl Send for DatabaseBackendRegistry
impl Sync for DatabaseBackendRegistry
impl Unpin for DatabaseBackendRegistry
impl !UnwindSafe for DatabaseBackendRegistry
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 more