drizzle (ws/index.ts)

drizzle-orm · drizzle-orm/src/libsql/ws/index.ts · typescript · Apache-2.0
database, Database / ORM

Creates a LibSQL database instance over WebSocket with optional config.

// Source: https://github.com/drizzle-team/drizzle-orm | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { type Client, type Config, createClient } from '@libsql/client/ws';
import { type DrizzleConfig, isConfig } from '~/utils.ts';
import { construct, type LibSQLDatabase } from '../driver-core.ts';

export function drizzle<
	TSchema extends Record<string, unknown> = Record<string, never>,
	TClient extends Client = Client,
>(
	...params: [
		TClient | string,
	] | [
		TClient | string,
		DrizzleConfig<TSchema>,
	] | [
		(
			& DrizzleConfig<TSchema>
			& ({
				connection: string | Config;
			} | {
				client: TClient;
			})
		),
	]
): LibSQLDatabase<TSchema> & {
	$client: TC

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key