kysely-turso
v0.1.1
Published
Kysely dialects for Turso
Downloads
602
Maintainers
Readme

Join the discussion ⠀⠀⠀⠀⠀⠀⠀
kysely-turso offers Kysely dialects for Turso's serverless driver and LibSQL client.
Installation
Node.js
npm install kysely-turso @tursodatabase/serverless kyselypnpm add kysely-turso @tursodatabase/serverless kyselyyarn add kysely-turso @tursodatabase/serverless kyselyOther runtimes
deno add npm:kysely-turso npm:@tursodatabase/serverless npm:kyselybun add kysely-turso @tursodatabase/serverless kyselyUsage
@tursodatabase/serverless
Interactive transactions are not supported as of @tursodatabase/[email protected].
import { connect } from '@tursodatabase/serverless'
import { type GeneratedAlways, Kysely } from 'kysely'
import { TursoServerlessDialect } from 'kysely-turso/serverless'
interface Database {
person: {
id: GeneratedAlways<number>;
first_name: string | null;
last_name: string | null;
age: number;
};
}
const db = new Kysely<Dataabase>({
dialect: new TursoServerlessDialect({
connection: connect({
authToken: process.env.TURSO_AUTH_TOKEN!,
url: process.env.TURSO_URL!,
}),
}),
})
const people = await db.selectFrom("person").selectAll().execute();@tursodatabase/serverless/compat
Signatures are defined, but nothing works as of @tursodatabase/[email protected].
import { createClient } from '@tursodatabase/serverless/compat'
import { type GeneratedAlways, Kysely } from 'kysely'
import { LibSQLialect } from 'kysely-turso/libsql'
interface Database {
person: {
id: GeneratedAlways<number>;
first_name: string | null;
last_name: string | null;
age: number;
};
}
const db = new Kysely<Dataabase>({
dialect: new LibSQLDialect({
client: createClient({ url: process.env.TURSO_URL! }),
}),
})
const people = await db.selectFrom("person").selectAll().execute();@libsql/client
import { createClient } from '@libsql/client'
import { type GeneratedAlways, Kysely } from 'kysely'
import { LibSQLialect } from 'kysely-turso/libsql'
interface Database {
person: {
id: GeneratedAlways<number>;
first_name: string | null;
last_name: string | null;
age: number;
};
}
const db = new Kysely<Dataabase>({
dialect: new LibSQLDialect({
client: createClient({ url: process.env.TURSO_URL! }),
}),
})
const people = await db.selectFrom("person").selectAll().execute();Contribution
Prerequisites
Acknowledgements
honzasp and penberg for creating and maintaining @libsql/kysely-libsql.
ottomated for maintaining the kysely-libsql fork. ❤️
