Registry / database / multidatastore-postgres

multidatastore-postgres

JSON →
library3.0.1jsnpmunverified

PostgreSQL driver for multidatastore, a library enabling multiple data stores (e.g., databases) to be accessed through a unified interface. Version 3.0.1 is the latest release. This package provides the PostgreSQL implementation, supporting standard SQL operations within the multidatastore framework. Release cadence is ad-hoc, with no recent updates. It is a thin wrapper over connect-pg-simple and pg-pool, primarily used in Node.js environments with PostgreSQL.

npm install multidatastore-postgres
INSTALL
IMPORT
SIG · MULTIDATASTORE-POS
M
multidatastore-postgres
databasejavascriptv3.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PostgresStore
import { PostgresStore } from 'multidatastore-postgres'
const PostgresStore = require('multidatastore-postgres')
ESM-only since v3; use dynamic import or transpilation for CJS
default
import multidatastorePostgres from 'multidatastore-postgres'
const multidatastorePostgres = require('multidatastore-postgres').default
Default export available; named exports also exist
PoolConfig
import type { PoolConfig } from 'multidatastore-postgres'
import { PoolConfig } from 'multidatastore-postgres'
PoolConfig is a TypeScript type; use type import to avoid runtime errors

Demonstrates instantiating a PostgresStore with a pg pool, setting and getting a key-value pair.

import { PostgresStore } from 'multidatastore-postgres'; import { createPool } from 'pg'; const pool = createPool({ host: process.env.PGHOST ?? 'localhost', port: parseInt(process.env.PGPORT ?? '5432'), database: process.env.PGDATABASE ?? 'mydb', user: process.env.PGUSER ?? 'user', password: process.env.PGPASSWORD ?? '', }); const store = new PostgresStore(pool); async function main() { await store.set('key', 'value'); const value = await store.get('key'); console.log(value); } main().catch(console.error);
Debug
Known issues
breakingVersion 3.x drops support for CommonJS; only ES modules are supported. Require() will throw Module not found.
fix
Use import syntax or upgrade to ESM-compatible environment.
affects: >=3.0.0
deprecatedConstructor signature changed: previous versions accepted connection string, now requires pg pool object.
fix
Create a pg.Pool instance and pass it to the constructor.
affects: >=3.0.0
breakingRemoved synchronous operations in v3; all methods return Promises.
fix
Use async/await or .then() for all store operations.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: store.set is not a function
Using old constructor signature with connection string instead of pg pool
fix
Create a pg.Pool and pass it: new PostgresStore(pool)
Cannot find module 'multidatastore-postgres'
Package not installed or using require() in ESM-only version
fix
Run npm install multidatastore-postgres and use import (ESM) syntax.
PoolConfig is not a constructor
Importing PoolConfig as a value instead of a type
fix
Use import type { PoolConfig } from 'multidatastore-postgres'.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
multidatastorerequiredPeer dependency: core library that defines the data store interface
Agent activity
2 hits · last 30 days
node
2
Resources
multidatastore-postgres — npm install multidatastore-postgres · libregistry