Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

LibsqlClient unstable

libSQL adapter for Effect SQL, backed by @libsql/client.

This module provides a LibsqlClient and the generic SQL client service for @libsql/client. It uses Effect SQL's SQLite compiler, supports managed SDK clients or caller-owned live clients, classifies libSQL and SQLite failures as SqlErrors, and provides transaction support with savepoints. Streaming queries are not implemented by this driver.

9 exports Since v4.0.0 Source

Constructors

make

unstable
Since v4.0.0

Creates a scoped libSQL SQL client with transaction support. When given connection options it creates and closes the SDK client; when given liveClient, the caller retains ownership.

Signature

declare function make(options: LibsqlClientConfig): Effect<LibsqlClient, never, Scope | Reactivity>

Layers

layer

unstable
Since v4.0.0

Creates a layer from a concrete libSQL client configuration, providing both LibsqlClient and SqlClient.

Signature

declare function layer(config: LibsqlClientConfig): Layer<LibsqlClient | SqlClient>

layerConfig

unstable
Since v4.0.0

Creates a layer from a Config-wrapped libSQL client configuration, providing both LibsqlClient and SqlClient.

Signature

declare const layerConfig: (config: Config.Wrap<LibsqlClientConfig>) => Layer.Layer<LibsqlClient | Client.SqlClient, Config.ConfigError>

Models

LibsqlClientConfig

type unstable
Since v4.0.0

Configuration for a libSQL client, either by supplying connection options or an existing live libSQL client.

Signature

type LibsqlClientConfig = LibsqlClientConfig.Full | LibsqlClientConfig.Live

Other

Since v4.0.0

Namespace containing the configuration variants for LibsqlClient.

Services

Since v4.0.0

Service tag for the libSQL client service.

When to use

Use to access or provide a libSQL client through the Effect context.

Signature

declare const LibsqlClient: Service<LibsqlClient, LibsqlClient>

LibsqlClient

interface unstable
Since v4.0.0

libSQL-backed SQL client service, extending SqlClient with its runtime type marker and client configuration.

Signature

interface LibsqlClient extends SqlClient {
<A extends object = Row>(strings: TemplateStringsArray, ...args: Array<any>): Statement<A>;
(value: string): Identifier;
readonly "~@effect/sql-libsql/LibsqlClient": "~@effect/sql-libsql/LibsqlClient";
readonly config: LibsqlClientConfig;
}

Type IDs

TypeId

unstable
Since v4.0.0

Runtime type identifier used to mark LibsqlClient values.

Signature

declare const TypeId: TypeId

TypeId

type unstable
Since v4.0.0

Type-level identifier used to mark LibsqlClient values.

Signature

type TypeId = "~@effect/sql-libsql/LibsqlClient"