Class: GraphResultSet

graph~ GraphResultSet

Represents the result set of a graph query execution containing vertices, edges or scalar values depending on the query.

It allows iteration of the items using for..of statements under ES2015 and exposes forEach(), first() and toArray() to access the underlying items.

Constructor

new GraphResultSet(result)

Creates a new instance of GraphResultSet.
Parameters:
Name Type Description
result ResultSet
Examples
for (let vertex of result} { ... }
const arr = result.toArray();
const vertex = result.first();

Members

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.

length :Number

Gets the length of the result.
Type:
  • Number

Methods

first()

Returns the first element of the result or null if the result is empty.

forEach(callback, thisArgopt)

Executes a provided function once per result element.
Parameters:
Name Type Attributes Description
callback function Function to execute for each element, taking two arguments: currentValue and index.
thisArg Object <optional>
Value to use as this when executing callback.

toArray() → {Array}

Results an Array of graph result elements (vertex, edge, scalar).
Returns:
Type
Array

values() → {Object}

Returns a new Iterator object that contains the values for each index in the result.
Returns:
Type
Object