Skip to content

createPostgresStorage

function createPostgresStorage(options?): PostgresLinksStorage;

Defined in: src/storage/postgres.ts:56

Create a Postgres-backed PostgresLinksStorage. The table is created lazily on first use; connection (when using connectionString/url) is also lazy.

Parameter Type
options? PostgresStorageOptions

PostgresLinksStorage

import { createPostgresStorage } from "@xtandard/links/storage/postgres";
// Via connection string (lazy `pg` Pool):
const storage = createPostgresStorage({
connectionString: process.env.DATABASE_URL,
});
// Or with a pre-built pg Pool / PGlite client:
// import { PGlite } from "@electric-sql/pglite";
// const storage = createPostgresStorage({ client: new PGlite() });