Constructor
new ResultSet(response, host, triedHosts, consistency)
Creates a new instance of ResultSet.
Parameters:
Name | Type | Description |
---|---|---|
response |
Object | |
host |
String | |
triedHosts |
Object | |
consistency |
Number |
Members
columns :Array.<{name, type}>
Gets the columns returned in this ResultSet.
Type:
- Array.<{name, type}>
- Default Value:
- null
info :Object
Information on the execution of a successful query:
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
achievedConsistency |
Number | The consistency level that has been actually achieved by the query. |
queriedHost |
String | The Cassandra host that coordinated this query. |
triedHosts |
Object | Gets the associative array of host that were queried before getting a valid response, being the last host the one that replied correctly. |
traceId |
Uuid | Identifier of the trace session. |
warnings |
Array.<string> | Warning messages generated by the server when executing the query. |
nextPage :function
Method used to manually fetch the next page of results.
This method is only exposed when using the Client#eachRow method and there are more rows available in
following pages.
Type:
- function
pageState :String
A string token representing the current page state of query. It can be used in the following executions to
continue paging and retrieve the remained of the result for the query.
Type:
- String
- Default Value:
- null
rowLength :Number
Gets the row length of the result, regardless if the result has been buffered or not
Type:
- Number
rows :Array.<Row>
Gets an array rows returned by the query, in case the result was buffered.
Type:
- Array.<Row>
Methods
@@iterator() → {Iterator.<Row>}
Gets the iterator function.
Retrieves the iterator of the underlying fetched rows and will not cause the driver to fetch the following result pages. For more information on result paging, visit the documentation.
Returns:
- Type
- Iterator.<Row>
Example
Using for...of statement
const query = 'SELECT name, email, address FROM users WHERE id = ?';
const result = await client.execute(query, [ id ], { prepare: true });
for (let row of result) {
console.log(row['email']);
}
first()
Returns the first row or null if the result rows are empty.