Home Reference Source
import Result from 'neo4j-driver/lib/v1/result.js'
public class | source

Result

A stream of Record representing the result of a statement. Can be consumed eagerly as Promise resolved with array of records and ResultSummary summary, or rejected with error that contains string code and string message. Alternatively can be consumed lazily using Result#subscribe function.

Method Summary

Public Methods
public

catch(onRejected: function(error: Neo4jError)): Promise

Catch errors when using promises.

public

subscribe(observer: Object)

Stream records to observer as they come in, this is a more efficient method of handling the results, and allows you to handle arbitrarily large results.

public

then(onFulfilled: function(result: {records: Array<Record>, summary: ResultSummary}), onRejected: function(error: {message: string, code: string})): Promise

Waits for all results and calls the passed in function with the results.

Public Methods

public catch(onRejected: function(error: Neo4jError)): Promise source

Catch errors when using promises. Cannot be used with the subscribe function.

Params:

NameTypeAttributeDescription
onRejected function(error: Neo4jError)

Function to be called upon errors.

Return:

Promise

promise.

public subscribe(observer: Object) source

Stream records to observer as they come in, this is a more efficient method of handling the results, and allows you to handle arbitrarily large results.

Params:

NameTypeAttributeDescription
observer Object

Observer object

observer.onNext function(record: Record)

handle records, one by one.

observer.onCompleted function(summary: ResultSummary)

handle stream tail, the result summary.

observer.onError function(error: {message: string, code: string})

handle errors.

public then(onFulfilled: function(result: {records: Array<Record>, summary: ResultSummary}), onRejected: function(error: {message: string, code: string})): Promise source

Waits for all results and calls the passed in function with the results. Cannot be combined with the Result#subscribe function.

Params:

NameTypeAttributeDescription
onFulfilled function(result: {records: Array<Record>, summary: ResultSummary})

function to be called when finished.

onRejected function(error: {message: string, code: string})

function to be called upon errors.

Return:

Promise

promise.