pub trait FetchFromDatabase: Send + Sync {
// Required methods
fn get<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 E::PrimaryKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>
where E: Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn count<'life0, 'async_trait, E>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<u32>> + Send + 'async_trait>>
where E: Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn load_all<'life0, 'async_trait, E>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Vec<E>>> + Send + 'async_trait>>
where E: Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn get_borrowed<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 <E as BorrowPrimaryKey>::BorrowedPrimaryKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>
where E: EntityGetBorrowed<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
E::PrimaryKey: Borrow<E::BorrowedPrimaryKey>,
for<'a> &'a E::BorrowedPrimaryKey: KeyType,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn get_unique<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<U>>> + Send + 'async_trait>>
where U: UniqueEntityExt<'a> + Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait { ... }
fn exists<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>
where U: UniqueEntityExt<'a> + Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Interface to fetch from the database either from the connection directly or through a transaction.
Fundamentally these are convenience methods, allowing you to do let n_foos = database.count::<Foo>()
instead of Foo::count(&mut database.conn).
Required Methods§
Sourcefn get<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 E::PrimaryKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>where
E: Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 E::PrimaryKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>where
E: Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get an instance of E from the database by its primary key.
Sourcefn count<'life0, 'async_trait, E>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<u32>> + Send + 'async_trait>>where
E: Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn count<'life0, 'async_trait, E>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<u32>> + Send + 'async_trait>>where
E: Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Count the number of Es in the database.
Sourcefn load_all<'life0, 'async_trait, E>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Vec<E>>> + Send + 'async_trait>>where
E: Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn load_all<'life0, 'async_trait, E>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Vec<E>>> + Send + 'async_trait>>where
E: Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Load all Es from the database.
Sourcefn get_borrowed<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 <E as BorrowPrimaryKey>::BorrowedPrimaryKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>where
E: EntityGetBorrowed<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
E::PrimaryKey: Borrow<E::BorrowedPrimaryKey>,
for<'a> &'a E::BorrowedPrimaryKey: KeyType,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_borrowed<'life0, 'life1, 'async_trait, E>(
&'life0 self,
id: &'life1 <E as BorrowPrimaryKey>::BorrowedPrimaryKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<E>>> + Send + 'async_trait>>where
E: EntityGetBorrowed<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
E::PrimaryKey: Borrow<E::BorrowedPrimaryKey>,
for<'a> &'a E::BorrowedPrimaryKey: KeyType,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get an instance of E from the database by the borrowed form of its primary key.
Provided Methods§
Sourcefn get_unique<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<U>>> + Send + 'async_trait>>where
U: UniqueEntityExt<'a> + Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn get_unique<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Option<U>>> + Send + 'async_trait>>where
U: UniqueEntityExt<'a> + Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Get the requested unique entity from the database.
Sourcefn exists<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
U: UniqueEntityExt<'a> + Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn exists<'a, 'life0, 'async_trait, U>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>where
U: UniqueEntityExt<'a> + Entity<ConnectionType = KeystoreDatabaseConnection> + Clone + Send + Sync + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Determine whether a unique entity is present in the database.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.