Skip to content

@lancedb/lancedb • Docs


@lancedb/lancedb / Listing

Class: Listing<T>

A lazy async iterator over database resources with pagination state. Requests occur during iteration; request errors terminate the iterator.

Example

for await (const name of connection.listViews([], { pageLimit: 20 })) {
  console.log(name);
}

Type Parameters

• T

Implements

  • AsyncIterableIterator<T>

Methods

[asyncIterator]()

asyncIterator: AsyncIterableIterator<T>

Returns

AsyncIterableIterator<T>

Implementation of

AsyncIterableIterator.[asyncIterator]


next()

next(): Promise<IteratorResult<T, any>>

Fetch the next item, requesting another page only when needed.

Returns

Promise<IteratorResult<T, any>>

Implementation of

AsyncIterableIterator.next


numPageResults()

numPageResults(): number

Number of cached items available without another request.

Returns

number


pageToken()

pageToken(): undefined | string

Token for the next request. Initially this is the supplied starting token. Returns undefined after fetching the final page, even with cached items. Drain the cache before saving a token to avoid skipping items on resumption. Failed requests terminate iteration and retain their token for a new iterator.

Returns

undefined | string