prorm API Reference
    Preparing search index...

    Class DgraphStore

    DgraphStore wraps a dgraph-js DgraphClient and exposes Dgraph's real surface: query() for parameterized DQL reads, mutate() for JSON mutations (auto-committed), and alter()/dropAll() for schema/data management.

    Implements

    Index
    name: "dgraph" = 'dgraph'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "dgraph-js" = 'dgraph-js'

    The client library being used

    • Runs a parameterized DQL query in a fresh transaction and returns the parsed JSON result. vars binds DQL query variables (e.g. { $name: 'alice' }) sent separately from the query text. The transaction is always discarded in a finally — a read-only query never needs committing, and discarding releases its server-side resources.

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • dql: string
      • vars: Record<string, string> = {}

      Returns Promise<T>

    • Applies a JSON mutation (setJson) and commits it immediately (commitNow: true), so no separate commit round trip is needed. The transaction is discarded in a finally as a safety net (committed transactions treat discard as a no-op).

      Parameters

      • setJson: unknown[] | Record<string, unknown>

      Returns Promise<unknown>

    • Alters the schema by forwarding a DQL schema definition (DDL) to client.alter({ schema }), e.g. 'name: string @index(exact) .'.

      Parameters

      • schema: string

      Returns Promise<unknown>

    • Drops all data and schema in the cluster via client.alter({ dropAll: true }).

      Returns Promise<unknown>