You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
778 B
28 lines
778 B
import {Iterable} from '../../../../../lib/src/collection/Iterable.ts'
|
|
import ConnectionExecutable from '../ConnectionExecutable.ts'
|
|
import {Collection} from '../../../../../lib/src/collection/Collection.ts'
|
|
import {QueryRow} from '../../../db/types.ts'
|
|
|
|
export class ResultIterable<T> extends Iterable<T> {
|
|
|
|
constructor(
|
|
protected executable: ConnectionExecutable<T>
|
|
) { super() }
|
|
|
|
async at_index(i: number): Promise<T | undefined> {
|
|
return this.executable.get_row(i)
|
|
}
|
|
|
|
async from_range(start: number, end: number): Promise<Collection<T>> {
|
|
return this.executable.get_range(start, end)
|
|
}
|
|
|
|
async count() {
|
|
return this.executable.count()
|
|
}
|
|
|
|
clone() {
|
|
return new ResultIterable(this.executable)
|
|
}
|
|
}
|