pub trait DatabaseConnection: Send + Sized {
type Error: Error;
// Required methods
fn authenticate(
&self,
jwt: &str,
) -> impl Future<Output = Result<(), AuthenticationError<Self::Error>>> + Send + Sized;
fn signin(
&self,
credentials: Credentials,
) -> impl Future<Output = Result<String, AuthenticationError<Self::Error>>> + Send + Sized;
fn me(
&self,
) -> impl Future<Output = Result<User, Self::Error>> + Send + Sized;
fn draft<D: Document + Send>(
&self,
id: &str,
data: Value,
) -> impl Future<Output = Result<Item<Value>, Self::Error>> + Send + Sized;
fn delete_draft<D: Document + Send + DeserializeOwned>(
&self,
id: &str,
) -> impl Future<Output = Result<Item<Value>, Self::Error>> + Send + Sized;
fn publish<D: Document + Send + Serialize + DeserializeOwned + 'static>(
&self,
id: &str,
publish_at: Option<DateTime<Utc>>,
data: Valid<D>,
) -> impl Future<Output = Result<Item<D>, Self::Error>> + Send + Sized;
fn put<D: Document + Serialize + DeserializeOwned + Send + Debug + 'static>(
&self,
item: Item<D>,
) -> impl Future<Output = Result<Item<D>, Self::Error>> + Send + Sized;
fn delete<D: Document + Send + Debug>(
&self,
id: &str,
) -> impl Future<Output = Result<Item<D>, Self::Error>> + Send + Sized;
fn get_all<D: Document + DeserializeOwned + Send>(
&self,
) -> impl Future<Output = Result<Vec<Item<Value>>, Self::Error>> + Send + Sized;
fn get_by_id<D: Document + DeserializeOwned + Send>(
&self,
id: &str,
) -> impl Future<Output = Result<Option<Item<Value>>, Self::Error>> + Send + Sized;
}
Required Associated Types§
Required Methods§
fn authenticate( &self, jwt: &str, ) -> impl Future<Output = Result<(), AuthenticationError<Self::Error>>> + Send + Sized
fn signin( &self, credentials: Credentials, ) -> impl Future<Output = Result<String, AuthenticationError<Self::Error>>> + Send + Sized
fn me(&self) -> impl Future<Output = Result<User, Self::Error>> + Send + Sized
fn draft<D: Document + Send>( &self, id: &str, data: Value, ) -> impl Future<Output = Result<Item<Value>, Self::Error>> + Send + Sized
fn delete_draft<D: Document + Send + DeserializeOwned>( &self, id: &str, ) -> impl Future<Output = Result<Item<Value>, Self::Error>> + Send + Sized
fn publish<D: Document + Send + Serialize + DeserializeOwned + 'static>( &self, id: &str, publish_at: Option<DateTime<Utc>>, data: Valid<D>, ) -> impl Future<Output = Result<Item<D>, Self::Error>> + Send + Sized
fn put<D: Document + Serialize + DeserializeOwned + Send + Debug + 'static>( &self, item: Item<D>, ) -> impl Future<Output = Result<Item<D>, Self::Error>> + Send + Sized
fn delete<D: Document + Send + Debug>( &self, id: &str, ) -> impl Future<Output = Result<Item<D>, Self::Error>> + Send + Sized
fn get_all<D: Document + DeserializeOwned + Send>( &self, ) -> impl Future<Output = Result<Vec<Item<Value>>, Self::Error>> + Send + Sized
fn get_by_id<D: Document + DeserializeOwned + Send>( &self, id: &str, ) -> impl Future<Output = Result<Option<Item<Value>>, Self::Error>> + Send + Sized
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.