Neodriver_eio.TxExplicit transactions (BEGIN/COMMIT/ROLLBACK with per-transaction state).
Explicit transaction on a single connection.
A t wraps a connection with the per-transaction state: Open after BEGIN, Failed after any error inside the transaction, Closed after COMMIT/ROLLBACK. Operations on a closed transaction return a Transaction_error "Transaction closed"; operations on a failed transaction fail without touching the server (except ROLLBACK, which recovers the connection with a RESET).
Modeled on the Python driver's AsyncTransaction (_async/work/transaction.py).
val begin_transaction :
Conn.t ->
extra:Neodriver_packstream.Packstream.value ->
(t, Neodriver_core.Errors.t) Stdlib.resultSend BEGIN on conn and return an Open transaction. A RESET is sent first if the connection is in the Failed state (recovering from a previous failed transaction).
val run :
t ->
hydration:Neodriver_core.Hydration.t ->
query:string ->
parameters:(string * Neodriver_core.Values.t) list ->
(Neodriver_eio__.Neo4j_result.t, Neodriver_core.Errors.t) Stdlib.resultSend RUN for query inside the transaction; the result is streamed lazily via Result. On any error the transaction becomes Failed and an Error _ is returned. The transaction's still-open results are drained before commit/rollback.
val commit : t -> (string option, Neodriver_core.Errors.t) Stdlib.resultSend COMMIT, applying the transaction's writes, and return the bookmark from the response.
val rollback : t -> (unit, Neodriver_core.Errors.t) Stdlib.resultSend ROLLBACK, discarding the transaction's writes (a RESET on a Failed connection).
val close : t -> (unit, Neodriver_core.Errors.t) Stdlib.resultClose the transaction, rolling back if it is still open.
val closed : t -> boolWhether the transaction has been committed or rolled back.
val failed : t -> boolWhether the transaction has failed.