Struct cosmos_utils::CosmosSaga [−][src]
pub struct CosmosSaga { /* fields omitted */ }Implementations
Constructs a new saga object which can be used to perform several cosmos operations in sequence. If any operation fails then all previous operations performed with the saga object will be reversed.
pub async fn delete<D: DeserializeOwned + Serialize + Send + Sync + 'static, C: ToString + Clone, S: ToString + Clone, P: Into<PartitionKeys> + Clone>(
&mut self,
collection_name: C,
pk: P,
document_id: S,
etag: Option<String>
) -> Result<(), CosmosErrorStruct>
pub async fn modify<D: Serialize + DeserializeOwned + Clone + Send + Sync + 'static, P: Into<PartitionKeys> + Clone, F: Fn(D) -> Fut, C: ToString + Clone, S: ToString + Clone, Fut: Future<Output = Result<D, Rejection>>>(
&mut self,
collection_name: C,
pk: P,
document_id: S,
transform: F
) -> Result<D, CosmosErrorStruct>
pub async fn upsert<'de, D: Serialize + DeserializeOwned + Send + Sync + 'static, P: Into<PartitionKeys> + Clone, I: ToString, C: ToString + Clone>(
&mut self,
collection_name: C,
pk: P,
document: &'de D,
document_id: I,
etag: Option<&str>
) -> Result<String, CosmosErrorStruct>
pub async fn insert<'de, D: Serialize + DeserializeOwned + Send + Sync + 'static, P: Into<PartitionKeys> + Clone, I: ToString, C: ToString + Clone>(
&mut self,
collection_name: C,
pk: P,
document: &'de D,
document_id: I,
etag: Option<&str>
) -> Result<String, CosmosErrorStruct>
Consumes the saga and makes adding new things to it impossible This currently does no execution but is async in order to allow async operations to be done here in the future. Currently sagas are eagerly executed, meaning that the operations is performed when the method is called.
Auto Trait Implementations
impl !RefUnwindSafe for CosmosSaga
impl Send for CosmosSaga
impl Sync for CosmosSaga
impl Unpin for CosmosSaga
impl !UnwindSafe for CosmosSaga
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more