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
    metricsAdapter: IEntityMetricsAdapter
    • Count entities matching the conjunction of field equality operands. This does not perform authorization since count does not load full entities. Note that this should be used with the same caution as loadManyByFieldEqualityConjunctionAsync regarding indexing since counts can be expensive on large datasets without appropriate indexes.

      Type Parameters

      • N extends string | number | symbol

      Parameters

      Returns Promise<number>

      count of entities matching the filters

    • Get cursor for a given entity that matches what loadPageAsync would produce. Useful for constructing pagination cursors for entities returned from other loader methods that can then be passed to loadPageAsync for pagination. Most commonly used for testing pagination behavior.

      Parameters

      • entity: TEntity

        The entity to get the pagination cursor for.

      Returns string

      The pagination cursor for the given entity.

    • Load an entity where uniqueFieldName equals fieldValue directly from the database, or null if no entity matches. See loadByIDFromDatabaseAsync for how this differs from the standard loader.

      Type Parameters

      • N extends string | number | symbol

      Parameters

      • uniqueFieldName: N

        entity field being queried

      • fieldValue: NonNullable<TFields[N]>

        uniqueFieldName field value being queried

      • modifiers: EntityLoaderRowLockingModifiers

        row locking modifiers for the query

      Returns Promise<TEntity | null>

      entity where uniqueFieldName equals fieldValue, or null if no entity matches the condition

      when multiple entities match the condition

      EntityNotAuthorizedError when viewer is not authorized to view the returned entity