import { Iterable } from '../../../../../lib/src/collection/Iterable.ts' import ConnectionExecutable from "../ConnectionExecutable.ts"; import {QueryRow} from "../../../db/types.ts"; import {Collection} from "../../../../../lib/src/collection/Collection.ts"; export abstract class ResultSet extends Iterable { protected constructor( protected executeable: ConnectionExecutable, ) { super() } abstract async process_row(row: QueryRow): Promise async at_index(i: number) { return this.process_row(await this.executeable.get_row(i)) } async from_range(start: number, end: number) { const results = await this.executeable.get_range(start, end) const returns = new Collection() for ( const row of results ) { returns.push(await this.process_row(row)) } return returns } async count() { return this.executeable.count() } }