Barreller
Ever wanted to populate a postgres db with tons of fake data? Well, barreller does that.
Barreller prescribes a way to define your tables, column values, and relationships, and then import infinite data into postgres.
Inspiration came from wanting to create lots of fake data, but being constained by maintaining the relationships between that data. Especially when sometimes those relationships depend on server-side generated primary keys.
As of this writing - very much a Work In Progress... But it does work!
Example usage:
// define the type for the table; ; ; ; // 'food' is the table name and it is also the string used to generate rowsbarrel.addTable'food', foodColumns; // this queues up the data to be inserted, but does NOT insert itbarrel.generateRow'food'; // inserts any queued up data. This is an async function.barrel.insert;
TODO
- finish the abstract Barrel class
- connect method
- disconnect method
- Convert current Barrel class to PostgresBarrel as subclass of Barrel
- Move driver implementation into drivers/pg.ts
- support
generatedKey(tableName, columnName)
for server generated private keys. - consider
batch.insertFunction
as a deferred promise object