Query
This class represents a Query object. Queries are constructed using the static helper methods.
Static Method Summary
Static Public Methods | ||
public static |
Returns the conjunction of multiple queries. |
|
public static |
Returns a query that matches all keys of an index that are between two values, excluding the boundaries. |
|
public static |
Returns a query that matches all keys of an index that equal to a value. |
|
public static |
Returns a query that matches all keys of an index that are greater or equal than a value. |
|
public static |
Returns a query that matches all keys of an index that are greater than a value. |
|
public static |
Returns a query that matches all keys of an index that are less or equal than a value. |
|
public static |
Returns a query that matches all keys of an index that are less than a value. |
|
public static |
Returns a query for the max key of an index. |
|
public static |
Returns a query for the min key of an index. |
|
public static |
Returns the disjunction of multiple queries. |
|
public static |
Returns a query that matches all keys of an index that are between two values, including the boundaries. |
Method Summary
Public Methods | ||
public |
keys(objectStore: IObjectStore, limit: number): Promise<Set<string>> Returns a promise of a set of keys fulfilling this query. |
|
public |
async values(objectStore: IObjectStore, limit: number): Promise<Array<*>> Returns a promise of an array of objects fulfilling this query. |
Static Public Methods
public static and(var_args: ...Query): Query source
Returns the conjunction of multiple queries.
Params:
Name | Type | Attribute | Description |
var_args | ...Query | The list of queries, which all have to be fulfilled. |
public static between(indexName: string, lower: *, upper: *): Query source
Returns a query that matches all keys of an index that are between two values, excluding the boundaries. The query matches all keys k, such that lower < k < upper.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index. |
|
lower | * | The lower bound. |
|
upper | * | The upper bound. |
public static eq(indexName: string, val: *): Query source
Returns a query that matches all keys of an index that equal to a value. The query matches all keys k, such that k = val.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index. |
|
val | * | The value to look for. |
public static ge(indexName: string, val: *): Query source
Returns a query that matches all keys of an index that are greater or equal than a value. The query matches all keys k, such that k ≥ val.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index. |
|
val | * | The lower bound of the query. |
public static gt(indexName: string, val: *): Query source
Returns a query that matches all keys of an index that are greater than a value. The query matches all keys k, such that k > val.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index. |
|
val | * | The lower bound of the query. |
public static le(indexName: string, val: *): Query source
Returns a query that matches all keys of an index that are less or equal than a value. The query matches all keys k, such that k ≤ val.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index. |
|
val | * | The upper bound of the query. |
public static lt(indexName: string, val: *): Query source
Returns a query that matches all keys of an index that are less than a value. The query matches all keys k, such that k < val.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index. |
|
val | * | The upper bound of the query. |
public static max(indexName: string): Query source
Returns a query for the max key of an index.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index, whose maximal key the query matches. |
public static min(indexName: string): Query source
Returns a query for the min key of an index.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index, whose minimal key the query matches. |
public static or(var_args: ...Query): Query source
Returns the disjunction of multiple queries.
Params:
Name | Type | Attribute | Description |
var_args | ...Query | The list of queries, out of which at least one has to be fulfilled. |
public static within(indexName: string, lower: *, upper: *): Query source
Returns a query that matches all keys of an index that are between two values, including the boundaries. The query matches all keys k, such that lower ≤ k ≤ upper.
Params:
Name | Type | Attribute | Description |
indexName | string | The name of the index. |
|
lower | * | The lower bound. |
|
upper | * | The upper bound. |
Public Methods
public keys(objectStore: IObjectStore, limit: number): Promise<Set<string>> source
Returns a promise of a set of keys fulfilling this query.
Params:
Name | Type | Attribute | Description |
objectStore | IObjectStore | The object store to execute the query on. |
|
limit | number |
|
Limits the number of results if given. |
Return:
Promise<Set<string>> | A promise of the set of keys relevant to this query. |
public async values(objectStore: IObjectStore, limit: number): Promise<Array<*>> source
Returns a promise of an array of objects fulfilling this query.
Params:
Name | Type | Attribute | Description |
objectStore | IObjectStore | The object store to execute the query on. |
|
limit | number |
|
Limits the number of results if given. |
Return:
Promise<Array<*>> | A promise of the array of objects relevant to this query. |