pub struct TransactionBuilder { /* private fields */ }Expand description
Implementations§
Source§impl TransactionBuilder
impl TransactionBuilder
Sourcepub fn new(connection: Connection) -> Self
pub fn new(connection: Connection) -> Self
Create a new transaction builder.
Sourcepub fn event(self, event: ProspectiveEvent) -> Self
pub fn event(self, event: ProspectiveEvent) -> Self
Add an event to the transaction.
Sourcepub fn events(self, events: impl IntoIterator<Item = ProspectiveEvent>) -> Self
pub fn events(self, events: impl IntoIterator<Item = ProspectiveEvent>) -> Self
Add multiple events to the transaction.
Sourcepub fn condition(self, condition: AppendCondition) -> Self
pub fn condition(self, condition: AppendCondition) -> Self
Add a condition to the transaction.
Sourcepub fn conditions(
self,
conditions: impl IntoIterator<Item = AppendCondition>,
) -> Self
pub fn conditions( self, conditions: impl IntoIterator<Item = AppendCondition>, ) -> Self
Add multiple conditions to the transaction.
Sourcepub fn require_not_exists(self, selector: EventSelector) -> Self
pub fn require_not_exists(self, selector: EventSelector) -> Self
Require that no events matching the selector exist.
Sourcepub fn require_exists(self, selector: EventSelector) -> Self
pub fn require_exists(self, selector: EventSelector) -> Self
Require that at least one event matching the selector exists.
Sourcepub fn with_transaction_id(self, transaction_id: impl Into<String>) -> Self
pub fn with_transaction_id(self, transaction_id: impl Into<String>) -> Self
Set a specific transaction ID for idempotency.
Sourcepub fn with_correlation_id(self, correlation_id: impl Into<String>) -> Self
pub fn with_correlation_id(self, correlation_id: impl Into<String>) -> Self
Set the correlation ID for grouping related events in a business flow.
See: https://github.com/cloudevents/spec/blob/main/cloudevents/extensions/correlation.md
Sourcepub fn with_causation_id(self, causation_id: impl Into<String>) -> Self
pub fn with_causation_id(self, causation_id: impl Into<String>) -> Self
Set the causation ID for parent-child event relationships.
See: https://github.com/cloudevents/spec/blob/main/cloudevents/extensions/correlation.md
Sourcepub async fn commit(self) -> Result<DatabaseAtRevisionImpl, DatabaseError>
pub async fn commit(self) -> Result<DatabaseAtRevisionImpl, DatabaseError>
Commit the transaction synchronously.
Returns the database at the new revision.
Sourcepub async fn commit_async(self) -> Result<CorrelationId, DatabaseError>
pub async fn commit_async(self) -> Result<CorrelationId, DatabaseError>
Commit the transaction asynchronously.
Returns a correlation ID for tracking.
Auto Trait Implementations§
impl Freeze for TransactionBuilder
impl !RefUnwindSafe for TransactionBuilder
impl Send for TransactionBuilder
impl Sync for TransactionBuilder
impl Unpin for TransactionBuilder
impl !UnwindSafe for TransactionBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request