Result
A stream of Record representing the result of a query. 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.
Member Summary
Public Members | ||
public |
[_a](onfinally: function() | null): Promise: string Called when finally the result is done |
Method Summary
Public Methods | ||
public |
[Symbol.asyncIterator](): PeekableAsyncIterator<Record<R>, ResultSummary> Provides a async iterator over the records in the result. |
|
public |
catch(onRejected: function(error: Neo4jError)): Promise Catch errors when using promises. |
|
public |
finally(onfinally: *): * |
|
public |
isOpen(): boolean Check if this result is active, i.e., neither a summary nor an error has been received by the result. |
|
public |
keys(): Promise<string[]> Returns a promise for the field keys. |
|
public |
subscribe(observer: Object): void 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 |
summary(): Promise<ResultSummary<T>> Returns a promise for the result summary. |
|
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 Members
public [_a](onfinally: function() | null): Promise: string source
Called when finally the result is done
Should not be combined with Result#subscribe function.
Return:
Promise | promise. |
Public Methods
public [Symbol.asyncIterator](): PeekableAsyncIterator<Record<R>, ResultSummary> source
Provides a async iterator over the records in the result.
Should not be combined with Result#subscribe or $Result#then functions.
public catch(onRejected: function(error: Neo4jError)): Promise source
Catch errors when using promises.
Should not be combined with Result#subscribe function.
Params:
Name | Type | Attribute | Description |
onRejected | function(error: Neo4jError) | Function to be called upon errors. |
Return:
Promise | promise. |
public isOpen(): boolean source
Check if this result is active, i.e., neither a summary nor an error has been received by the result.
Return:
boolean |
|
public keys(): Promise<string[]> source
Returns a promise for the field keys.
Should not be combined with Result#subscribe function.
Return:
Promise<string[]> | Field keys, in the order they will appear in records. } |
public subscribe(observer: Object): void 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:
Name | Type | Attribute | Description |
observer | Object | Observer object |
|
observer.onKeys | function(keys: string[]) | handle stream head, the field keys. |
|
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. |
Return:
void |
public summary(): Promise<ResultSummary<T>> source
Returns a promise for the result summary.
Should not be combined with Result#subscribe function.
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.
Should not be combined with Result#subscribe function.
Params:
Name | Type | Attribute | Description |
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. |