gremlin
    Preparing search index...

    Represents the primary DSL of the Gremlin traversal machine.

    Index

    Constructors

    Properties

    _boundTransaction?: Transaction
    • set by Transaction.begin() for gtx.tx() to return the owning transaction
    graph: Graph
    graphTraversalClass: typeof GraphTraversal = GraphTraversal

    Optional GraphTraversal constructor.

    graphTraversalSourceClass: typeof GraphTraversalSource = GraphTraversalSource

    Optional GraphTraversalSource constructor.

    gremlinLang: default = ...

    Optional GremlinLang instance.

    remoteConnection?: RemoteConnection
    traversalStrategies: TraversalStrategies

    Methods

    • Runs a unit of work inside a transaction, owning the full lifecycle.

      The transaction is begun automatically and the resulting transaction-bound GraphTraversalSource (gtx) is passed to the callback as its sole argument. Only gtx is in scope inside the callback, which avoids accidentally issuing traversals against the non-transactional g.

      On normal completion of the callback the transaction is committed; on any abnormal exit (a thrown error or a rejected promise) the transaction is rolled back. This is a single-shot operation: there is exactly one attempt (begin -> run -> commit/rollback) and no retry. A second transaction may not be opened from inside the callback (calling gtx.tx().begin() throws via the existing double-begin guard).

      The callback may be synchronous or asynchronous; its return value (or the value its promise resolves to) is awaited and returned from executeInTx. If the callback returns nothing the result is undefined.

      Error handling: if the callback throws/rejects, the original error is re-raised unchanged after rollback is attempted. If the commit itself fails, the commit error propagates and a rollback is still attempted afterward for server-side hygiene. In both cases a failed rollback during cleanup is logged as a warning and never replaces the primary error.

      Type Parameters

      • T

      Parameters

      • txWork: (gtx: GraphTraversalSource) => T | Promise<T>

        callback that receives the transaction-bound GraphTraversalSource

      Returns Promise<T>

      resolves to the callback's value (undefined if none)