0.5.2 • Published 5 months ago

@prisma/ppg v0.5.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
5 months ago

@prisma/ppg

Modern, lightweight, minimal serverless client for Prisma Postgres®.

Installation

Install this package using your package manager and registry of choice:

  • npm: npm install @prisma/ppg
  • pnpm: pnpm add @prisma/ppg (or pnpm add jsr:@prisma/ppg)
  • Yarn: yarn add @prisma/ppg
  • Bun: bun add @prisma/ppg
  • Deno: deno add jsr:@prisma/ppg
  • esm.sh CDN: https://esm.sh/@prisma/ppg

Usage

The recommended API for most users is the ppg function, which returns a high-level SQL client implemented as a template literal tag function:

import { ppg } from "@prisma/ppg";

const sql = ppg("prisma+postgres://accelerate.prisma-data.net/?api_key=...");

const userId = 1;
const posts = await sql`SELECT * FROM posts WHERE user_id = ${userId}`;

The interpolated values are automatically converted to SQL parameters to prevent SQL injection attacks.

For low level control, use the Client class directly:

import { Client } from "@prisma/ppg";

const client = new Client({
  connectionString: "prisma+postgres://accelerate.prisma-data.net/?api_key=...",
});

const posts = await client.query("SELECT * FROM posts WHERE user_id = $1", [1]);

Limitations

Transactions are not currently supported.

License

Apache-2.0

0.5.2

5 months ago

0.5.1

5 months ago

0.5.0

5 months ago

0.4.1

5 months ago

0.4.0

5 months ago

0.3.0

5 months ago

0.2.0

5 months ago

0.1.2

6 months ago

0.1.0

6 months ago