pub trait XmtpDb: MaybeSend + MaybeSync {
type Connection: ConnectionExt + MaybeSend + MaybeSync;
type DbQuery: DbQuery + MaybeSend + MaybeSync;
// Required methods
fn opts(&self) -> &StorageOption;
fn conn(&self) -> Self::Connection;
fn db(&self) -> Self::DbQuery;
fn reconnect(&self) -> Result<(), ConnectionError>;
fn disconnect(&self) -> Result<(), ConnectionError>;
// Provided methods
fn init(&self) -> Result<(), ConnectionError> { ... }
fn validate(
&self,
_conn: &mut SqliteConnection,
) -> Result<(), ConnectionError> { ... }
}Required Associated Types§
Sourcetype Connection: ConnectionExt + MaybeSend + MaybeSync
type Connection: ConnectionExt + MaybeSend + MaybeSync
The Connection type for this database
type DbQuery: DbQuery + MaybeSend + MaybeSync
Required Methods§
Sourcefn opts(&self) -> &StorageOption
fn opts(&self) -> &StorageOption
The Options this database was created with
Sourcefn conn(&self) -> Self::Connection
fn conn(&self) -> Self::Connection
Returns the Connection implementation for this Database
Sourcefn db(&self) -> Self::DbQuery
fn db(&self) -> Self::DbQuery
Returns a higher-level wrapeped DbConnection from which high-level queries may be accessed.
Sourcefn reconnect(&self) -> Result<(), ConnectionError>
fn reconnect(&self) -> Result<(), ConnectionError>
Reconnect to the database
Sourcefn disconnect(&self) -> Result<(), ConnectionError>
fn disconnect(&self) -> Result<(), ConnectionError>
Release connection to the database, closing it
Provided Methods§
fn init(&self) -> Result<(), ConnectionError>
Sourcefn validate(&self, _conn: &mut SqliteConnection) -> Result<(), ConnectionError>
fn validate(&self, _conn: &mut SqliteConnection) -> Result<(), ConnectionError>
Validate a connection is as expected