Interface QueryOptions<Item, EntityToken, M, HashKey, RangeKey, T>

Options passed to the EntityManager.query method.

interface QueryOptions<Item, EntityToken, M, HashKey, RangeKey, T> {
    entityToken: EntityToken;
    hashKey: string;
    item?: Item;
    limit?: number;
    pageKeyMap?: string;
    pageSize?: number;
    queryMap: Record<string, ShardQueryFunction<Item, EntityToken, M, HashKey, RangeKey, T>>;
    sortOrder?: SortOrder<Item>;
    throttle?: number;
    timestampFrom?: number;
    timestampTo?: number;
}

Type Parameters

Properties

entityToken: EntityToken

Identifies the entity to be queried. Key of EntityManager.config.entities.

hashKey: string

Identifies the entity key across which the query will be sharded. Key of EntityManager.config.entities.<entityToken>.keys.

item?: Item

A partial ItemMap object containing at least the properties specified in EntityManager.config.entities.<entityToken>.keys.<keyToken>.elements, except for the properties specified in EntityManager.config.tokens.

This data will be used to generate query keys across all shards.

limit?: number

The target maximum number of records to be returned by the query across all shards.

The actual number of records returned will be a product of pageSize and the number of shards queried, unless limited by available records in a given shard.

pageKeyMap?: string

pageKeyMap returned by the previous iteration of this query.

pageSize?: number

The maximum number of records to be returned by each individual query to a single shard (i.e. ShardQueryFunction execution).

Note that, within a given query method execution, these queries will be repeated until either available data is exhausted or the limit value is reached.

Each key in this object is a valid entity index token. Each value is a valid 'ShardQueryFunction' that specifies the query of a single page of data on a single shard for the mapped index.

This allows simultaneous queries on multiple sort keys to share a single page key, e.g. to match the same string against firstName and lastName properties without performing a table scan for either.

sortOrder?: SortOrder<Item>

A SortOrder object specifying the sort order of the result set. Defaults to [].

throttle?: number

The maximum number of shards to query in parallel. Overrides options throttle.

options.throttle

timestampFrom?: number

Lower limit to query shard space.

Only valid if the query is constrained along the dimension used by the EntityManager.config.entities.<entityToken>.sharding.timestamptokens.timestamp function to generate shardKey.

0

timestampTo?: number

Upper limit to query shard space.

Only valid if the query is constrained along the dimension used by the EntityManager.config.entities.<entityToken>.sharding.timestamptokens.timestamp function to generate shardKey.

Date.now()