Skip to main content
Module

x/neo4j_driver_lite/mod.ts>Result

Neo4j Bolt driver for JavaScript
Go to Latest
class Result
implements Promise<QueryResult<R>>
Re-export
import { Result } from "https://deno.land/x/neo4j_driver_lite@5.14.0-alpha01/mod.ts";

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.

Constructors

new
Result(
streamObserverPromise: Promise<observer.ResultStreamObserver>,
query: Query,
parameters?: any,
connectionHolder?: connectionHolder.ConnectionHolder,
watermarks?: { high: number; low: number; },
)

Inject the observer to be used.

Properties

private
readonly
_connectionHolder: connectionHolder.ConnectionHolder
private
_error: Error | null
private
_keys: string[] | null
private
_p: Promise<QueryResult> | null
private
readonly
_parameters: any
private
readonly
_query: Query
private
readonly
_stack: string | null
private
readonly
_streamObserverPromise: Promise<observer.ResultStreamObserver>
private
_summary: ResultSummary | null
private
readonly
_watermarks: { high: number; low: number; }
[Symbol.toStringTag]: string

Called when finally the result is done

Should not be combined with Result#subscribe function.

Methods

private
_createQueuedResultObserver(onQueueSizeChanged: () => void): QueuedResultObserver
private
_getOrCreatePromise(): Promise<QueryResult<R>>

Create and return new Promise

private
_releaseConnectionAndGetSummary(metadata: any): Promise<ResultSummary>
_cancel(): void

Signals the stream observer that the future records should be discarded on the server.

Decorates the ResultObserver with the necessary methods.

_subscribe(observer: ResultObserver, paused?: boolean): Promise<observer.ResultStreamObserver>

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.

catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<QueryResult<R> | TResult>

Catch errors when using promises.

Should not be combined with Result#subscribe function.

finally(onfinally?: (() => void) | null): Promise<QueryResult<R>>
isOpen(): boolean

Check if this result is active, i.e., neither a summary nor an error has been received by the result.

keys(): Promise<string[]>

Returns a promise for the field keys.

Should not be combined with Result#subscribe function.

subscribe(observer: ResultObserver<R>): 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.

Returns a promise for the result summary.

Should not be combined with Result#subscribe function.

then<TResult1 = QueryResult<R>, TResult2 = never>(onFulfilled?: ((value: QueryResult<R>) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>

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

Should not be combined with Result#subscribe function.

[Symbol.asyncIterator](): PeekableAsyncIterator<Record<R>, ResultSummary>

Provides a async iterator over the records in the result.

Should not be combined with Result#subscribe or $Result#then functions.