teil/update.rs
1use crate::{
2 Error,
3 ConnectionType
4};
5
6#[cfg(feature = "sync")]
7use crate::SyncConnectionType;
8
9/// Guide trait for `Update` associated types
10///
11/// This trait is enforces in the associated type `Update` from the [Teil](crate::Teil) trait. When using the derive macro of the trait, you don't need to worry about `Update`.
12#[async_trait::async_trait]
13pub trait Update {
14 /// Should run the associated script in the database to perform the update
15 async fn execute(self) -> Result<bool, Error>;
16
17 /// This function is auxiliar, but meant to be hidden
18 #[doc(hidden)]
19 async fn execute_with_connection<'a>(self, connection_type: ConnectionType<'a>) -> Result<bool, Error>;
20}
21
22/// Guide trait for `Update` associated types
23///
24/// This trait is enforces in the associated type `Update` from the [Teil](crate::Teil) trait. When using the derive macro of the trait, you don't need to worry about `Update`.
25#[cfg(feature = "sync")]
26pub trait SyncUpdate {
27 /// Should run the associated script in the database to perform the update
28 fn execute(self) -> Result<bool, Error>;
29
30 /// This function is auxiliar, but meant to be hidden
31 #[doc(hidden)]
32 fn execute_with_connection<'a>(self, connection_type: SyncConnectionType<'a>) -> Result<bool, Error>;
33}