Entity
    Preparing search index...

    Class EnforcingKnexEntityLoader<TFields, TIDField, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>

    Enforcing knex entity loader for non-data-loader-based load methods. All loads through this loader will throw if the load is not successful.

    Type Parameters

    Index

    Constructors

    Properties

    metricsAdapter: IEntityMetricsAdapter

    Methods

    • Load entities with a raw SQL WHERE clause.

      Parameters

      • rawWhereClause: string

        SQL WHERE clause. Interpolated values should be specified as ?-placeholders or :key_name

      • bindings: object | any[]

        values to bind to the placeholders in the WHERE clause

      • querySelectionModifiers: EntityLoaderQuerySelectionModifiersWithOrderByRaw<TFields, TSelectedFields> = {}

        limit, offset, and orderBy for the query. If orderBy is specified as orderByRaw, specify as string orderBy SQL clause with uncheckd literal values or ?-placeholders

      Returns Promise<readonly TEntity[]>

      entities matching the WHERE clause

      Load entities with SQL function

      const entitiesWithJsonKey = await ExampleEntity.loader(vc)
      .loadManyByRawWhereClauseAsync(
      "json_column->>'key_name' = ?",
      ['value'],
      );

      Load entities with tuple matching

      const entities = await ExampleEntity.loader(vc)
      .loadManyByRawWhereClauseAsync(
      '(column_1, column_2) IN ((?, ?), (?, ?))',
      [value1, value2, value3, value4],
      );

      EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities

      Error when rawWhereClause or bindings are invalid