Class StubDatabaseAdapter<T>

A database adapter is an interface by which entity objects can be fetched, inserted, updated, and deleted from a database. This base class handles all entity field transformation. Subclasses are responsible for implementing database-specific logic for a type of database.

Type Parameters

  • T

Hierarchy

Constructors

Properties

dataStore: Map<string, Readonly<{
    [key: string]: any;
}>[]>
entityConfiguration2: EntityConfiguration<T>

Methods

  • Fetch many objects matching the raw WHERE clause.

    Parameters

    • queryContext: EntityQueryContext

      query context with which to perform the fetch

    • rawWhereClause: string

      parameterized SQL WHERE clause with positional binding placeholders or named binding placeholders

    • bindings: object | any[]

      array of positional bindings or object of named bindings

    • querySelectionModifiers: QuerySelectionModifiersWithOrderByRaw<T>

      limit, offset, and orderBy for the query

    Returns Promise<readonly Readonly<T>[]>

    array of objects matching the query

  • Fetch many objects where fieldName is one of fieldValues.

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • queryContext: EntityQueryContext

      query context with which to perform the fetch

    • field: K
    • fieldValues: readonly NonNullable<T[K]>[]

      fieldName field values being queried

    Returns Promise<ReadonlyMap<NonNullable<T[K]>, readonly Readonly<T>[]>>

    map from fieldValue to objects that match the query for that fieldValue

  • Update an object.

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • queryContext: EntityQueryContext

      query context with which to perform the update

    • idField: K

      the field in the object that is the ID

    • id: any

      the value of the ID field in the object

    • object: Readonly<Partial<T>>

      the object to update

    Returns Promise<Readonly<T>>

    the updated object

Generated using TypeDoc