The PostgreSQL specialized package of Sedentary.
import { SedentaryPG } from "sedentary-pg";
const db = new SedentaryPG(/* PG connection */);
class Items extends db.model("Item", {
num: db.INT,
str: db.VarChar(30)
});
(async function () {
await db.connect();
const item = Items.create();
item.num = 0;
item.str = "0";
await item.save();
const records = await Items.load({});
console.log(records); // [{ id: 1, num: 0, str: "0" }]
})();
With npm:
$ npm install --save sedentary-pg
The full documentation is on sedentary.readthedocs.io.
Requires:
- Node.js: v14
- TypeScript: v4.6 (or none if used in a JavaScript project).
The package is tested under all version combinations of Node.js currently supported accordingly to Node.js Release and of PostgreSQL currently supported accordingly to PostgreSQL Versioning.
To work with the package under Windows, be sure to configure bash.exe
as your script-shell.
> npm config set script-shell bash.exe
Do not hesitate to report any bug or inconsistency @github.
If you find useful this package, please consider the opportunity to donate some satoshis to this bitcoin address: 1Md9WFAHrXTb3yPBwQWmUfv2RmzrtbHioB