1.0.2 • Published 5 years ago
pgtables v1.0.2
PGTables
Installation
npm i --save pgtables
Usage
const { Table } = require('pgtables');
// open a table
const Users = new Table('Users');
// read single row from table
const user = await Users.open({ Name: 'abc' }).read();
// if more than one row is returned, the function will throw an error
console.log(user.data.ID);
// update an entry
user.data.Name = 'def';
await user.write();
// insert a new entry
const newuser = await Users.open({ Name: 'asdf', EMail: 'ghjk@example.com' }).write();
// delete an entry
await newuser.deleteRow();