import {Collection, Iterable} from '../../../util' import {Connection} from '../../connection/Connection' import {AbstractBuilder} from '../AbstractBuilder' /** * Base Iterable class that generates the results of a Builder query. */ export abstract class AbstractResultIterable extends Iterable { protected constructor( /** The builder whose results should be iterated */ public readonly builder: AbstractBuilder, /** The connection on which to execute the builder. */ public readonly connection: Connection, ) { super() } /** * Get the SQL string for the SELECT query for this iterable. */ public abstract get selectSQL(): string /** * Get the result at index i. * @param i */ public abstract at(i: number): Promise /** * Get the results starting at index `start` and ending at index `end`. * @param start * @param end */ public abstract range(start: number, end: number): Promise> /** * Count the number of results of the query. */ public abstract count(): Promise /** * Return all items resulting from this query. */ public abstract all(): Promise> /** * Create a new iterable based on this query. */ public abstract clone(): AbstractResultIterable }