Transactions

From MemCP
Jump to navigation Jump to search

← Back to Full SCM API documentation


tx_commit

Commits the current transaction.

Allowed number of parameters: 1–1

Parameters

  • session (func(key:string?, value:any?) -> any): the session function that holds tx state

Returns

bool

tx_rollback

Rolls back the current transaction.

Allowed number of parameters: 1–1

Parameters

  • session (func(key:string?, value:any?) -> any): the session function that holds tx state

Returns

bool

with_autocommit

Executes fn inside an implicit TxCursorStability transaction if no explicit transaction is active in session. Commits on success, rolls back on error, and re-raises any panic so the caller's error handler still fires. If an explicit transaction is active (session["transaction"] != nil), fn is executed without any wrapping.

Allowed number of parameters: 2–2

Parameters

  • session (func(key:string?, value:any?) -> any): the session function holding tx state
  • fn (func): zero-argument function to execute

Returns

any