prorm API Reference
    Preparing search index...

    Class BaseGraphDialectAbstract

    Abstract base class for database dialects Provides common functionality for all dialect implementations

    Hierarchy (View Summary)

    Index
    createProcedure dropProcedure renameColumn addForeignKey bulkInsert createFulltextIndex createSpatialIndex listSchemas createDatabaseSQL dropDatabaseSQL createSavepointSQL releaseSavepointSQL rollbackToSavepointSQL createExtension dropExtension getExtensions hasExtension createEnumType dropType createDomain dropDomain buildCreateServerQuery buildAlterServerQuery buildDropServerQuery buildCreateUserMappingQuery buildAlterUserMappingQuery buildDropUserMappingQuery createUserMapping dropUserMapping buildCreateForeignTableQuery buildDropForeignTableQuery buildImportForeignSchemaQuery getServersQuery buildCreateUserQuery buildAlterUserQuery buildDropUserQuery getUsersQuery buildGrantQuery buildRevokeQuery buildShowGrantsQuery buildFlushPrivilegesQuery buildCreateRoleQuery buildDropRoleQuery buildGrantRoleQuery buildRevokeRoleQuery getRolesQuery buildJsonQuery formatValue formatDate replaceReplacements replacePositionalReplacements replaceNamedReplacements escapeReplacement parseValue getIsolationLevelSql resolveAllInclude generateSelectColumns flattenIncludesWithAll connect disconnect query getDatabaseVersion startTransaction commitTransaction rollbackTransaction renderPredicate compileMatch compileCreateNode compileUpdateNodes compileDeleteNodes compileUpsertNode compileIncrement compileCreateEdge compileTraverse compileCreateConstraint compileDropConstraint compileCreateIndex compileDropIndex compileShowLabels getConnection isConnected queryStream escape escapeId quoteIdentifier quoteTable getDataTypeSql run paramValues randomOrderTerm requireRandomOrderTerm normalizeOrder mapIncludes buildWhereClause buildOrderClause buildLimitOffset buildInsertQuery buildUpdateQuery buildDeleteQuery buildSelectQuery buildUpsertQuery buildIncrementQuery identityKeys createTable dropTable addIndex createIndex removeIndex dropIndex createConstraint dropConstraint addConstraint removeConstraint showTables showViews showMaterializedViews showConstraints showIndexes describeTable createSchema dropSchema showAllSchemas addColumn removeColumn changeColumn commentTable commentColumn defineNode defineEdge createNode findNodes updateNodes destroyNodes relate traverse createPartitionedTable createPartition attachPartition detachPartition dropPartition createView dropView createMaterializedView refreshMaterializedView dropMaterializedView hasMaterializedView createStoredProcedure dropStoredProcedure executeStoredProcedure hasStoredProcedure createTrigger dropTrigger hasTrigger createSequence dropSequence nextSequenceValue hasSequence createPolicy dropPolicy enableRLS disableRLS hasPolicy createPartialIndex createExpressionIndex createIdentityColumn createComputedColumn renameTable changeOwner createForeignDataWrapper dropForeignDataWrapper createForeignServer dropForeignServer createForeignTable createSecurityPolicy dropSecurityPolicy
    _connection: any = null
    _connected: boolean = false
    dialectName: string = 'unknown'
    nodeModels: Map<string, NodeModelDefinition> = ...

    In-memory registry of node/edge models defined through the builder.

    edgeModels: Map<string, EdgeModelDefinition> = ...
    name: string

    The name of the dialect

    library: string

    The database library or driver being used

    • get defaultNodeVar(): string

      Variable name node properties are addressed through in generated queries.

      Returns string

    • Rename a column (default throws error)

      Parameters

      • _tableName: string
      • _oldColumnName: string
      • _newColumnName: string

      Returns Promise<void>

    • Add a foreign key (default throws error)

      Parameters

      • _tableName: string
      • _columnName: string
      • _referencedTableName: string
      • _referencedColumnName: string
      • Optional_options: any

      Returns Promise<void>

    • Bulk insert records (default implementation)

      Parameters

      • tableName: string
      • records: Record<string, any>[]
      • Optional_options: any

      Returns Promise<QueryResult>

    • Create a fulltext index (default throws error)

      Parameters

      • _tableName: string
      • _indexName: string
      • _fields: string[]
      • Optional_options: { parser?: string; comment?: string }

      Returns Promise<void>

    • Create a spatial index (default throws error)

      Parameters

      • _tableName: string
      • _indexName: string
      • _fields: string[]
      • Optional_options: { storage?: string; srid?: number }

      Returns Promise<void>

    • Generate SQL for creating a database (default implementation)

      Parameters

      • options: {
            name: string;
            encoding?: string;
            lcCollate?: string;
            lcCtype?: string;
            template?: string;
            tablespace?: string;
            collate?: string;
            isTemplate?: boolean;
        }

        Database creation options

      Returns string

    • Generate SQL for creating a savepoint

      Parameters

      • Optionalname: string

        Savepoint name (optional, will be generated if not provided)

      Returns string

    • Check if a PostgreSQL extension is installed (only supported in PostgreSQL)

      Parameters

      • _extensionName: string

      Returns Promise<boolean>

      True if the extension is installed

    • Parameters

      • _name: string
      • Optional_opts: { ifExists?: boolean; cascade?: boolean }

      Returns string

    • Parameters

      • _serverName: string
      • _user: string
      • Optional_opts: { ifExists?: boolean }

      Returns string

    • Create a user mapping (default throws error)

      Parameters

      • _userName: string
      • _serverName: string
      • Optional_options: any

      Returns Promise<void>

    • Drop a user mapping (default throws error)

      Parameters

      • _userName: string
      • _serverName: string
      • Optional_options: any

      Returns Promise<void>

    • Parameters

      • _tableName: string
      • Optional_opts: { ifExists?: boolean; cascade?: boolean }

      Returns string

    • Build a JSON/JSONB path query Default implementation using common JSON extraction syntax

      Parameters

      • column: string

        The JSON/JSONB column name

      • path: string

        The JSON path to access (e.g., 'key' or 'key.subkey')

      • Optionalvalue: unknown

        The value to compare against (optional)

      • operator: string = '='

        The comparison operator to use (defaults to =)

      Returns { sql: string; values: unknown[] }

      SQL fragment and values for the JSON query

    • Replace placeholders in SQL with actual values Supports both named (:param) and positional (?) placeholders Properly escapes values to prevent SQL injection

      Parameters

      • sql: string
      • Optionalreplacements: unknown[] | Record<string, unknown>

      Returns string

    • Replace named (:param) placeholders with escaped values

      Parameters

      • sql: string
      • replacements: Record<string, unknown>

      Returns string

    • Generate column list with proper aliasing to avoid duplicates

      Parameters

      • mainTableName: string
      • mainTableAlias: string
      • Optionalattributes: string[] | { include?: string[]; exclude?: string[] }
      • Optionalincludes: { tableName: string; alias: string }[]

      Returns string

    • Compile an upsert (MERGE-equivalent) keyed on conflictKeys.

      Parameters

      • label: string
      • data: Record<string, unknown>
      • conflictKeys: string[]

      Returns GraphStatement

    • Compile a numeric increment of one or more properties.

      Parameters

      • label: string
      • fields: string | string[] | Record<string, number>
      • where: WhereOptions | undefined
      • by: number

      Returns GraphStatement

    • Object-mode streaming: runs the query and pushes one row (or mapped model instance) per chunk. Graph drivers don't share a common cursor API, so this buffers the driver result and re-emits it — correct and dialect-agnostic, matching the Model.findAllStream() contract.

      Parameters

      Returns Readable

    • Quote a table name

      Parameters

      • tableName: string

        The table name to quote

      • Optional_schema: string

        Optional schema to prefix the table with

      Returns string

    • The engine-native term that shuffles results, or null when this graph engine has no random ordering at all.

      Cypher has rand() and Gremlin has order().by(shuffle); Dgraph DQL's orderasc/orderdesc only take a predicate, so it keeps the null default and requireRandomOrderTerm raises the typed capability error instead of emitting something that would silently not shuffle.

      Returns string | null

    • Tolerant Order -> [field, dir][] normalizer.

      Also understands the asc() / desc() / random() order helpers from src/operators.ts. They arrive as plain OrderExpression objects, so without an explicit branch they fell through the $col/column check below and were dropped silently — the helpers simply did nothing on every graph dialect. random() becomes a 'RANDOM' term with no field, which each compile* translates (or refuses) in its own language.

      Parameters

      Returns GraphOrderTerm[]

    • Build a LIMIT/OFFSET clause

      Parameters

      • Optionallimit: string | number

        Limit value

      • Optionaloffset: string | number

        Offset value

      Returns string

    • Build an INSERT query

      Parameters

      • tableName: string

        Table name

      • values: Record<string, any>

        Values to insert

      • Optional_options: InsertOptions

        Query options

      Returns { sql: string; values: any[] }

    • Build an increment query

      Parameters

      • tableName: string

        Table name

      • fields: string | string[] | Record<string, number>

        Fields to increment

      • where: WhereOptions

        Where clause

      • Optionaloptions: { by?: number }

        Query options (by: number)

      Returns { sql: string; values: any[] }

    • Identity property/properties for a label (defaults to id).

      Parameters

      • label: string

      Returns string[]

    • "CREATE TABLE" for a graph store = declare a node label and materialize its schema hints: unique/primary-key columns become uniqueness constraints, references columns become association edges, and indexed columns become property indexes. Nodes themselves stay schemaless.

      Parameters

      Returns Promise<void>

    • Add an index to a table

      Parameters

      • tableName: string

        Name of the table

      • indexName: string

        Name of the index

      • fields: string[]

        Fields to index

      • Optional_options: IndexOptions

        Index options

      Returns Promise<void>

    • Remove an index from a table

      Parameters

      • tableName: string

        Name of the table

      • indexName: string

        Name of the index

      Returns Promise<void>

    • Add a constraint to a table

      Parameters

      • tableName: string
      • options: {
            type: "UNIQUE" | "PRIMARY KEY" | "FOREIGN KEY" | "CHECK";
            fields: string[];
            name?: string;
            references?: { table: string; fields: string[] };
            check?: string;
        }

      Returns Promise<void>

    • Remove a column from a table

      Parameters

      • tableName: string

        Name of the table

      • columnName: string

        Name of the column to remove

      Returns Promise<void>

    • Add comment to a column

      Parameters

      • _tableName: string
      • _columnName: string
      • _comment: string

      Returns Promise<void>

    • Check if a stored procedure exists

      Parameters

      • _procedureName: string
      • Optional_schema: string

      Returns Promise<boolean>

      True if the stored procedure exists

    • Check if a trigger exists

      Parameters

      • _triggerName: string
      • _tableName: string

      Returns Promise<boolean>

      True if the trigger exists

    • Enable row-level security on a table (PostgreSQL)

      Parameters

      • _tableName: string
      • Optional_schema: string

      Returns Promise<void>

    • Disable row-level security on a table (PostgreSQL)

      Parameters

      • _tableName: string
      • Optional_schema: string

      Returns Promise<void>

    • Check if a policy exists (PostgreSQL RLS)

      Parameters

      • _policyName: string
      • _tableName: string

      Returns Promise<boolean>

      True if the policy exists