Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kysely-postgres-js

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kysely-postgres-js

Kysely dialect for PostgreSQL using the Postgres.js client

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

kysely-postgres-js

Powered by TypeScript

Kysely dialect for PostgreSQL using the Postgres.js client library under the hood (version >= 3.4).

This dialect should not be confused with Kysely's built-in PostgreSQL dialect, which uses the pg client library instead.

Installation

NPM 7+
npm i kysely-postgres-js
NPM <7
npm i kysely-postgres-js kysely postgres
Yarn
yarn add kysely-postgres-js kysely postgres
PNPM
pnpm add kysely-postgres-js kysely postgres

Deno

This package uses/extends some Kysely types and classes, which are imported using its NPM package name -- not a relative file path or CDN url. It also uses [Postgres.js] which is imported using its NPM package name -- not a relative file path or CDN url.

To fix that, add an import_map.json file.

{
  "imports": {
    "kysely": "https://cdn.jsdelivr.net/npm/kysely@0.26.3/dist/esm/index.js",
    "postgres": "https://deno.land/x/postgresjs@v3.4.0/mod.js"
  }
}

Usage

import {type GeneratedAlways, Kysely} from 'kysely'
import {PostgresJSDialect} from 'kysely-postgres-js'
import postgres from 'postgres'

interface Database {
  person: {
    id: GeneratedAlways<number>
    first_name: string | null
    last_name: string | null
    age: number
  }
}

const db = new Kysely<Database>({
  dialect: new PostgresJSDialect({
    postgres: postgres({
      database: 'test',
      host: 'localhost',
      max: 10,
      port: 5434,
      user: 'admin',
    }),
  }),
})

License

MIT License, see LICENSE

Keywords

FAQs

Package last updated on 26 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc