mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-19 18:22:28 +00:00
CatalogConnection.list_databases should return an iterator so that users don't have to manually re-implement pagination. For those who do want more control over pagination, add num_page_results and page_token to the Iterator object, and also allow the iterator object to be created at a specific page token.
80 lines
1.3 KiB
Markdown
80 lines
1.3 KiB
Markdown
[**@lancedb/lancedb**](../README.md) • **Docs**
|
|
|
|
***
|
|
|
|
[@lancedb/lancedb](../globals.md) / DatabaseNames
|
|
|
|
# Class: DatabaseNames
|
|
|
|
A lazy async iterator of database names with pagination state.
|
|
Returned by [Catalog.listDatabases](Catalog.md#listdatabases).
|
|
|
|
## Implements
|
|
|
|
- `AsyncIterableIterator`<`string`>
|
|
|
|
## Methods
|
|
|
|
### \[asyncIterator\]()
|
|
|
|
```ts
|
|
asyncIterator: AsyncIterableIterator<string>
|
|
```
|
|
|
|
#### Returns
|
|
|
|
`AsyncIterableIterator`<`string`>
|
|
|
|
#### Implementation of
|
|
|
|
`AsyncIterableIterator.[asyncIterator]`
|
|
|
|
***
|
|
|
|
### next()
|
|
|
|
```ts
|
|
next(): Promise<IteratorResult<string, any>>
|
|
```
|
|
|
|
Fetch the next name, requesting another page only when needed.
|
|
|
|
#### Returns
|
|
|
|
`Promise`<`IteratorResult`<`string`, `any`>>
|
|
|
|
#### Implementation of
|
|
|
|
`AsyncIterableIterator.next`
|
|
|
|
***
|
|
|
|
### numPageResults()
|
|
|
|
```ts
|
|
numPageResults(): number
|
|
```
|
|
|
|
Number of names available without another REST request.
|
|
|
|
#### Returns
|
|
|
|
`number`
|
|
|
|
***
|
|
|
|
### pageToken()
|
|
|
|
```ts
|
|
pageToken(): undefined | string
|
|
```
|
|
|
|
Token for the next REST request. Initially this is the supplied starting token.
|
|
Returns undefined after the final page is fetched, even if names remain cached.
|
|
Drain the cache before saving a token to avoid skipping names when resuming.
|
|
A failed request terminates iteration and retains its token for a new iterator.
|
|
|
|
#### Returns
|
|
|
|
`undefined` \| `string`
|