@triply/triplydb
    Preparing search index...

    Class ResultIterator<ResultType, Output>

    A lazy, paginated collection of results.

    Returned by every method that yields a collection — an Account's getDatasets, Dataset.getGraphs, Dataset.getAssets and so on. Never constructed directly.

    Results are fetched a page at a time, as they are consumed, so iterating and stopping early costs only the pages you actually read.

    A collection can be consumed only once. Iterating and toArray advance the same cursor, so collecting after a partial iteration yields only what is left of the collection rather than all of it.

    for await (const dataset of account.getDatasets()) {
    if (dataset.slug === 'iris') break
    }

    Type Parameters

    • ResultType

      the shape of a single result in the API response, before it is mapped.

    • Output

      what iterating yields: a Dataset, a Query, a binding, and so on.

    Hierarchy (View Summary)

    Implements

    Index
    • Iterates the results, fetching each page as it is reached.

      Returns AsyncIterator<Output>

    • Fetches every remaining page and returns all results as an array.

      Returns Promise<Output[]>

      Consumes the whole collection, so prefer iterating when you only need part of it.

      const datasets = await account.getDatasets().toArray()