pub struct ConnectionManager { /* private fields */ }
Expand description
Connection Manager
The connection manager is used to manage the connections to the database.
Implementations§
Source§impl ConnectionManager
impl ConnectionManager
Sourcepub fn get_database_type(&self) -> ConnectionType
pub fn get_database_type(&self) -> ConnectionType
Get the type of database
Sourcepub async fn connect(connection: impl Into<String>) -> Result<Self, Error>
pub async fn connect(connection: impl Into<String>) -> Result<Self, Error>
Connect to a database
Examples:
:memory:
,file://:memory:
(in-memory SQLite database)sqlite://./test.db
(SQLite database at./test.db
)libsql:///path/to/db
(libsql database at/path/to/db
)postgres://user:pass@localhost:5432/dbname
(Postgres database)
Sourcepub async fn in_memory() -> Result<Self, Error>
pub async fn in_memory() -> Result<Self, Error>
Connect to an in-memory database
This is only supported for sqlite based databases.
Sourcepub async fn path(path: impl Into<PathBuf>) -> Result<Self, Error>
pub async fn path(path: impl Into<PathBuf>) -> Result<Self, Error>
Connect to a database at a given path
Sourcepub async fn acquire(&self) -> Connection<'_>
pub async fn acquire(&self) -> Connection<'_>
Acquire a connection from the pool
Sourcepub fn insert_backend(&self, backend: Backend)
pub fn insert_backend(&self, backend: Backend)
Insert a connection back into the pool
Trait Implementations§
Source§impl Clone for ConnectionManager
impl Clone for ConnectionManager
Source§impl Default for ConnectionManager
impl Default for ConnectionManager
Source§impl From<Connection> for ConnectionManager
impl From<Connection> for ConnectionManager
Source§fn from(value: Connection) -> Self
fn from(value: Connection) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ConnectionManager
impl RefUnwindSafe for ConnectionManager
impl !Send for ConnectionManager
impl !Sync for ConnectionManager
impl Unpin for ConnectionManager
impl UnwindSafe for ConnectionManager
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> 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