@lastshotlabs/slingshot-postgres
npm install @lastshotlabs/slingshot-postgres
Functions
Section titled “Functions”connectPostgres
Section titled “connectPostgres”A connected Postgres handle bundling a raw pg.Pool and a Drizzle ORM client.
pool— passed to plugin adapters that accept a rawpg.Pool(permissions, push, webhooks).db— passed to Drizzle-based adapters such ascreatePostgresAdapter(auth).
async function connectPostgres(connectionString: string, options: PostgresConnectionOptions = {},): Promise<DrizzlePostgresDb>Source: packages/slingshot-postgres/src/connection.ts
createPostgresAdapter
Section titled “createPostgresAdapter”Internal cursor payload encoded in opaque pagination cursors.
Carries both the createdAt ISO string and the record id so that the
(createdAt, id) compound index can be used for stable keyset pagination.
Remarks: Cursors are transmitted as base64-encoded JSON strings. The JSON object is stringified, then passed through btoa() to produce the opaque cursor that clients receive. decodeCursor reverses this with atob() + JSON.parse.
async function createPostgresAdapter(opts: PostgresAdapterOptions): Promise<AuthAdapter>Source: packages/slingshot-postgres/src/adapter.ts
parseMigrationVersion
Section titled “parseMigrationVersion”Internal cursor payload encoded in opaque pagination cursors.
Carries both the createdAt ISO string and the record id so that the
(createdAt, id) compound index can be used for stable keyset pagination.
Remarks: Cursors are transmitted as base64-encoded JSON strings. The JSON object is stringified, then passed through btoa() to produce the opaque cursor that clients receive. decodeCursor reverses this with atob() + JSON.parse.
function parseMigrationVersion(raw: unknown, maxVersion: number): numberSource: packages/slingshot-postgres/src/adapter.ts
Interfaces
Section titled “Interfaces”DrizzlePostgresDb
Section titled “DrizzlePostgresDb”A connected Postgres handle bundling a raw pg.Pool and a Drizzle ORM client.
pool— passed to plugin adapters that accept a rawpg.Pool(permissions, push, webhooks).db— passed to Drizzle-based adapters such ascreatePostgresAdapter(auth).
Source: packages/slingshot-postgres/src/connection.ts
PostgresAdapterOptions
Section titled “PostgresAdapterOptions”Internal cursor payload encoded in opaque pagination cursors.
Carries both the createdAt ISO string and the record id so that the
(createdAt, id) compound index can be used for stable keyset pagination.
Remarks: Cursors are transmitted as base64-encoded JSON strings. The JSON object is stringified, then passed through btoa() to produce the opaque cursor that clients receive. decodeCursor reverses this with atob() + JSON.parse.
Source: packages/slingshot-postgres/src/adapter.ts
PostgresConnectionOptions
Section titled “PostgresConnectionOptions”A connected Postgres handle bundling a raw pg.Pool and a Drizzle ORM client.
pool— passed to plugin adapters that accept a rawpg.Pool(permissions, push, webhooks).db— passed to Drizzle-based adapters such ascreatePostgresAdapter(auth).
Source: packages/slingshot-postgres/src/connection.ts
PostgresPoolConfig
Section titled “PostgresPoolConfig”A connected Postgres handle bundling a raw pg.Pool and a Drizzle ORM client.
pool— passed to plugin adapters that accept a rawpg.Pool(permissions, push, webhooks).db— passed to Drizzle-based adapters such ascreatePostgresAdapter(auth).
Source: packages/slingshot-postgres/src/connection.ts