Skip to content

The ORM which never needs to migrate - PostgreSQL

License

Notifications You must be signed in to change notification settings

iccicci/sedentary-pg

Repository files navigation

sedentary-pg

Build Status Code Climate Test Coverage

NPM version NPM downloads Stars

Types Dependents Donate

under development

Description

The PostgreSQL specilized package of Sedentary.

Usage

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" }]
})();

Installation

With npm:

$ npm install --save sedentary-pg

Documentation

The full documentation is on sedentary.readthedocs.io.

Compatibility

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

Licence

MIT Licence

Bugs

Do not hesitate to report any bug or inconsistency @github.

Donating

If you find useful this package, please consider the opportunity to donate some satoshis to this bitcoin address: 1Md9WFAHrXTb3yPBwQWmUfv2RmzrtbHioB