Files
lancedb/docs/src/js/classes/Listing.md
T
Colin Patrick McCabe de005f1d61 refactor!: implement lazy iterators for several APIs (#4459)
Implement lazy iterators for:
- secrets
- views
- jobs
- functions
- materialized views
2026-10-07 10:24:20 -07:00

1.4 KiB

@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