@yadah/objection-iterator
v0.2.0
Published
Objection.js mixin to allow async iteration of query results
Downloads
8
Readme
Objection Iterator mixin
A mixin for Objection.js Model classes that allows using queries as async iterables. It allows streaming query results!
Usage
import { mixin, Model } from "objection";
import IteratorMixin from "@yadah/objection-iterator";
class MyModel extends mixin(Model, [IteratorMixin]) {
static tableName = "mytable";
async doSomething() {
//
}
}
for await (const model of MyModel.query()) {
model instanceof MyModel; // true
await model.doSomething();
}