@blueleader07/typeorm
Version:
Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB databases.
40 lines (38 loc) • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DynamoReadStream = void 0;
const stream_1 = require("stream");
class DynamoReadStream extends stream_1.Stream.Readable {
constructor(repository, options) {
super();
this.repository = repository;
this.options = options;
}
_read() {
this.repository
.scan(this.options)
.then((items) => {
if (items.length > 0) {
for (let i = 0; i < items.length; i++) {
const item = items[i];
this.push(item);
}
if (items.LastEvaluatedKey) {
this.options.exclusiveStartKey = items.LastEvaluatedKey;
}
else {
this.push(null);
}
}
else {
this.push(null);
}
})
.catch((error) => {
console.error(error);
throw new Error("failed to stream dynamodb results");
});
}
}
exports.DynamoReadStream = DynamoReadStream;
//# sourceMappingURL=DynamoReadStream.js.map