QueryResultSet
Direct Subclass:
Instances of QueryResultSet hold a set of models retrieved from the database for a given query and offset.
Complete vs Incomplete:
QueryResultSet keeps an array of item ids and a lookup table of models.
The lookup table may be incomplete if the QuerySubscription isn't finished
preparing results. You can use isComplete
to determine whether the set
has every model.
Offset vs Index:
To avoid confusion, "index" (used within the implementation) refers to an item's position in an array, and "offset" refers to it's position in the query result set. For example, an item might be at index 20 in the _ids array, but at offset 120 in the result.
Static Method Summary
Static Public Methods | ||
public static |
setByApplyingModels(set: *, models: *): * |
Constructor Summary
Public Constructor | ||
public |
constructor(other: {}) |
Method Summary
Public Methods | ||
public |
clone(): * |
|
public |
count(): QueryRange |
|
public |
|
|
public |
idAtOffset(offset: Number): Array |
|
public |
|
|
public |
|
|
public |
modelAtOffset(offset: Number): Model |
|
public |
modelWithId(id: String): Model |
|
public |
|
|
public |
offsetOfId(id: String): Number |
|
public |
query(): Query |
|
public |
range(): QueryRange |
Protected Methods | ||
protected |
modelCacheCount(): * |
Static Public Methods
public static setByApplyingModels(set: *, models: *): * source
Params:
Name | Type | Attribute | Description |
set | * | ||
models | * |
Return:
* |
Public Constructors
public constructor(other: {}) source
Params:
Name | Type | Attribute | Description |
other | {} |
|
Public Methods
public count(): QueryRange source
Return:
QueryRange | The number of items in the represented range. Note
that a range ( |
public idAtOffset(offset: Number): Array source
Params:
Name | Type | Attribute | Description |
offset | Number | The desired offset. |
public isComplete(): Boolean source
Return:
Boolean | True if every model in the result set is available, false if part of the set is still being loaded. (Usually following range changes.) |
public modelAtOffset(offset: Number): Model source
Params:
Name | Type | Attribute | Description |
offset | Number | The desired offset. |
public modelWithId(id: String): Model source
Params:
Name | Type | Attribute | Description |
id | String | The desired ID. |
public models(): Array source
Return:
Array | An array of model objects. If the result is not yet complete,
this array may contain |
public offsetOfId(id: String): Number source
Params:
Name | Type | Attribute | Description |
id | String | The desired ID. |