TransactionPlan

Mutable container for building a sequence of database operations to be executed atomically.

Collects TransactionStep instances and their corresponding StepHandles, enabling deferred execution within a single transaction via org.octavius.data.DataAccess.executeTransactionPlan.

Useful when transaction steps need to be constructed dynamically based on runtime data (e.g., form submissions with variable number of related entities).

Usage Example

val plan = TransactionPlan()

val userHandle = plan.add(
dataAccess.insertInto("users").values(userData).asStep().toField<Int>()
)

plan.add(
dataAccess.insertInto("profiles")
.values(mapOf("user_id" to userHandle.field()))
.asStep().execute()
)

dataAccess.executeTransactionPlan(plan)

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun <T> add(step: TransactionStep<T>): StepHandle<T>

Adds a step to the plan and returns a handle for referencing its result in subsequent steps.

Link copied to clipboard
fun addPlan(otherPlan: TransactionPlan)

Adds all steps from another transaction plan to the current plan.