Entity

    Class EntityDatabaseAdapter<TFields, TIDField>Abstract

    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

    • TFields extends Record<string, any>
    • TIDField extends keyof TFields

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Delete an object by ID.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • queryContext: EntityQueryContext

        query context with which to perform the deletion

      • idField: K

        the field in the object that is the ID

      • id: any

        the value of the ID field in the object

      Returns Promise<void>

    • Parameters

      • queryInterface: any
      • tableName: string
      • tableIdField: string
      • id: any

      Returns Promise<number>

    • Parameters

      • queryInterface: any
      • tableName: string
      • tableColumns: readonly string[]
      • tableTuples: (readonly any[])[]

      Returns Promise<object[]>

    • Parameters

      • queryInterface: any
      • tableName: string
      • object: object

      Returns Promise<object[]>

    • 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<TFields>>

        the object to update

      Returns Promise<Readonly<TFields>>

      the updated object

    • Parameters

      • queryInterface: any
      • tableName: string
      • tableIdField: string
      • id: any
      • object: object

      Returns Promise<object[]>

    MMNEPVFCICPMFPCPTTAAATR