Transactions

From MemCP
Revision as of 08:36, 27 August 2026 by Carli (talk | contribs) (Created page with " ← Back to Full SCM API documentation == tx_commit == Commits the current transaction. '''Allowed number of parameters:''' 1–1 <span id="parameters-2"></span> === Parameters === * '''session''' (<code>func(key:string?, value:any?) -> any</code>): the session function that holds tx state <span id="returns-2"></span> === Returns === <code>bool</code> == tx_rollback == Rolls back the current transaction. '''Allowed number of parameters:''' 1–1 <span...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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