LibsqlClient
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.
Constructors
Layers
Creates a layer from a concrete libSQL client configuration, providing both LibsqlClient and SqlClient.
Signature
declare function layer(config: LibsqlClientConfig): Layer<LibsqlClient | SqlClient>;layerConfig
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
Configuration for a libSQL client, either by supplying connection options or an existing live libSQL client.
Signature
type LibsqlClientConfig = LibsqlClientConfig.Full | LibsqlClientConfig.Live;Other
LibsqlClientConfig
Namespace containing the configuration variants for LibsqlClient.
Services
LibsqlClient
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
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;}
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.