Interface DittoTransactionFunction<T>
- Type Parameters:
T- the type of value returned upon successful transaction commit.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface for executing operations within a database transaction.
This interface defines a callback that receives a DittoTransaction and performs
database operations within it. The callback returns a DittoTransaction.Result indicating
whether to commit or rollback the transaction.
This is a functional interface whose functional method is onTransaction(DittoTransaction),
making it suitable for lambda expressions and method references.
- See Also:
-
Method Summary
Modifier and TypeMethodDescription@NonNull CompletionStage<DittoTransaction.Result<T>> onTransaction(@NonNull DittoTransaction transaction) Executes operations within the provided transaction.
-
Method Details
-
onTransaction
@NonNull CompletionStage<DittoTransaction.Result<T>> onTransaction(@NonNull DittoTransaction transaction) Executes operations within the provided transaction.
Implement this method to perform database operations within the transaction context. Return a
DittoTransaction.Result.Committo persist changes or aDittoTransaction.Result.Rollbackto discard them.- Parameters:
transaction- theDittoTransactionto execute operations within.- Returns:
- a
CompletionStagethat completes with aDittoTransaction.Resultindicating whether to commit or rollback.
-