pg-doc-store1.2.1 • Public • Published
Purpose and features
Opionated solution for storing documents as entities in postgres without an ORM-solution. This package aims to use postgres as a document store (storing json data as documents) but with the benefits of Postgres as a platform and with the occasional use of SQL features such as referential integrity between identifiers.
Store a document
const db = crud;const id = "12903821";const type = "person";const person =name: "J Doe";db;
Load a document
const db = crud;const id = "12903821";db;
All updates uses upsert and stores updates to an existing entity as a new version in the entity_version table. The entity table contains a reference to the latest version. Attributes are stored in the entity_version table, i.e. the attributes column contains a specific version of the JSON document.