@xata.io/kysely
TypeScript icon, indicating that this package has built-in type declarations

0.1.21 • Public • Published

@xata.io/kysely

A Kysely dialect for Xata, using the Xata serverless driver for TypeScript.

Installation

You should install both kysely and @xata.io/kysely with @xata.io/client. You can install them with your favorite package manager:

# with bun
bun install kysely @xata.io/kysely @xata.io/client

# with pnpm
pnpm add kysely @xata.io/kysely @xata.io/client

# with yarn
yarn add kysely @xata.io/kysely @xata.io/client

# with npm
npm install kysely @xata.io/kysely @xata.io/client

Usage

You can pass a new instance of XataDialect as the dialect option when creating a new Kysely instance:

import { Kysely } from 'kysely';
import { XataDialect, Model } from '@xata.io/kysely';
import { DatabaseSchema, getXataClient } from './xata.ts';

const xata = getXataClient();

const db = new Kysely<Model<DatabaseSchema>>({
  dialect: new XataDialect({ xata })
});

const drivers = await db.selectFrom('users').select(['name', 'email']).execute();

XataDialect accepts your Xata client instance as its only option. You can find more information about creating a Xata client instance in our getting started guide.

Readme

Keywords

none

Package Sidebar

Install

npm i @xata.io/kysely

Weekly Downloads

4,615

Version

0.1.21

License

Apache-2.0

Unpacked Size

39 kB

Total Files

10

Last publish

Collaborators

  • tudorg
  • sferadev