Constructors

Properties

connection: AbstractConnection
instance?: Model<any, any>
model?: ModelStatic
sequelize: Sequelize
sql: string
uuid: string

Methods

  • Logs a SQL query with optional parameters and returns a function to log completion. When benchmarking is enabled, the completion logger emits timing information.

    Parameters

    • sql: string

      The SQL string to log.

    • debugContext: (msg: string) => void

      A function receiving debug messages.

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

      Optional bound parameters to display when enabled.

    Returns () => void

    A callback to be invoked after query execution to finalize logging.

  • Applies attribute-type parsing to an array of value objects.

    Parameters

    • valueArrays: Record<string, unknown>[]

      Array of objects to parse in-place.

    • Optionalmodel: ModelStatic

      The model providing attribute types for parsing.

    • OptionalincludeMap: IncludeMap

      Include lookup map for nested parsing.

    Returns Record<string, unknown>[]

    The same array instance after parsing.

  • Parses a raw database value using the attribute's data-type parser when available.

    Parameters

    • value: unknown

      The raw value to parse.

    • OptionalattributeType: NormalizedDataType

      The normalized data type to parse with.

    Returns unknown

    The parsed value, or the original value if no parser applies.

  • Applies attribute-type parsing to a single object. Descends into includes when present.

    Parameters

    • values: Record<string, unknown>

      The object to mutate with parsed values.

    • Optionalmodel: ModelStatic

      The model providing attribute types for parsing.

    • OptionalincludeMap: IncludeMap

      Include lookup map for nested parsing.

    Returns Record<string, unknown>

    The mutated values object.

  • Post-processes a SELECT result set according to the query options:

    • Remaps field names when fieldMap is provided.
    • Returns raw nested objects when raw and nest are set.
    • Groups JOINed rows into nested include graphs and builds model instances otherwise.

    Parameters

    • results: Record<string, unknown>[]

      The raw rows returned by the driver.

    Returns unknown

    Raw objects or built model instances depending on options.

  • Groups a flat array of JOINed rows into nested objects according to include definitions.

    Algorithm overview:

    • Sorts row keys by depth to build prefix metadata once on the first row.
    • For each row, computes stable identity hashes for each include prefix using PK/unique-key values to de-duplicate repeated JOIN combinations.
    • Uses a global resultMap keyed by hash to re-use previously materialized containers and attach children in O(1) time.
    • In non-dedup mode, directly builds nested objects for each row without hashing.

    Complexity:

    • First row metadata setup: O(K log K) for K keys due to depth sort.
    • Each subsequent row: O(K) for value assignment and at most O(depth) hash lookups.

    Parameters

    Returns Record<string, unknown>[]

    An array of nested objects ready for model-building or raw return.