CrSqliteExtension overview
CR-SQLite extension loading and information utilities.
This module provides low-level utilities for loading the CR-SQLite extension and retrieving information about it. It handles the dynamic import of the native library, loads the extension into the SQLite connection, and provides structured information about the loaded extension.
The main operations include:
- Loading the CR-SQLite extension from the native library
- Querying extension information (SHA, site ID)
- Creating Effect services for dependency injection
Added in v0.1.0
Table of contents
Configuration
LibCrSqlPathKey
Configuration key for the CR-SQLite extension library path.
This key is used to retrieve the filesystem path to the CR-SQLite extension library from the configuration. It is expected that the path points to a valid shared library file (e.g., .so, .dylib, .dll).
Signature
export declare const LibCrSqlPathKey: "CRSQLITE_PATH"
Added in v0.1.1
Operations
loadLibCrSql
Load the CR-SQLite extension and return complete information.
This function performs the complete extension loading sequence:
- Dynamically imports the native library
- Gets the extension file path
- Loads the extension into the SQLite connection
- Queries the extension for SHA and site ID
- Returns complete information including loading metadata
Signature
export declare const loadLibCrSql: Effect.Effect<
{ readonly sha: string; readonly siteId: string; readonly path: string | null; readonly loadedAt: DateTime.Utc },
CrSqlErrors.CrSqliteExtensionMissing,
SqlClient.SqlClient
>
Added in v0.1.0
Queries
sqlExtInfo
Query CR-SQLite extension information via SQL functions.
Retrieves the extension’s SHA and site ID by calling the built-in CR-SQLite functions crsql_sha() and crsql_site_id(). This requires the extension to already be loaded into the SQLite connection.
Signature
export declare const sqlExtInfo: Effect.Effect<
{ readonly sha: string; readonly siteId: string },
CrSqlErrors.CrSqliteExtensionMissing,
SqlClient.SqlClient
>
Added in v0.1.0
Services
ExtInfoLoaded (class)
Effect service for accessing loaded CR-SQLite extension information.
This service automatically loads the CR-SQLite extension and provides access to the complete extension information including SHA, site ID, filesystem path, and loading timestamp.
Signature
export declare class ExtInfoLoaded
Added in v0.1.0