{"metadata":{"name":"hew/db/sqlite","vers":"0.7.2","description":"Actor-owned SQLite client with typed errors and query snapshots","license":"MIT OR Apache-2.0","authors":["Hew Contributors"],"deps":[{"name":"hew.db.sql","req":"0.7.0","features":[],"optional":false,"default_features":true}],"features":{},"keywords":["database","sqlite","sql"],"repository":"https://github.com/hew-lang/ecosystem","edition":"2026","hew":">=0.10.0, <0.12.0","readme":"# hew.db.sqlite\n\n`hew.db.sqlite` is an actor-owned embedded SQL client. Operations fail with a\ntyped `SqliteError`, query replies are immutable wire-safe snapshots, and SQL\n`NULL` is represented by `CellValue.Null`. The query result types come from\n[`hew.db.sql`](../sql/README.md), shared with MySQL and PostgreSQL.\n\nEvery method is a `receive fn ... -> T fails SqliteError`, so a call replies\nwith `Result<T, ActorError<SqliteError>>`: `.Ok(value)` on success,\n`.Err(.Failed(error))` for a SQL failure, and another `.Err` when the actor\ncould not answer (for example, `.Dead` after it stopped).\n\n```hew\nimport hew.db.sqlite;\nimport std.encoding.utf8;\n\nfn main() {\n    let db = spawn sqlite.Db { path: \":memory:\" };\n    let _ = db.execute(\"CREATE TABLE values_table (value TEXT)\");\n    let _ = db.execute(\"INSERT INTO values_table VALUES ('hello')\");\n    match db.query(\"SELECT value FROM values_table\") {\n        .Ok(query) => match query.rows[0].values[0] {\n            .Text(value) => println(utf8.decode_lossy(value)),\n            .Null => println(\"value is NULL\"),\n        }\n        .Err(.Failed(error)) => println(sqlite.error_message(error)),\n        .Err(_) => println(\"SQLite actor stopped before replying\"),\n    }\n    stop(db);\n    stopped(db);\n}\n```\n\nThe checked, self-contained example lives at\n[`examples/basic.hew`](examples/basic.hew). Run it from the ecosystem checkout:\n\n```sh\nhew run --pkg-path . db/sqlite/examples/basic.hew\n```\n\nParameterized methods accept `Vec<Param>` from `hew.db.sql`. For example,\n`[Param.Int(42), Param.Text(\"First line\\nSecond line\"), Param.Null]` binds three\nvalues. Use `Param.Bytes(data)` for arbitrary binary data, including invalid\nUTF-8. Empty values and NULL stay distinct. See [typed SQL parameters](../sql/README.md)\nfor all six variants and database-specific conversions. Cell payloads remain\n`bytes`, preserving exact values. SQL strings cross the native boundary with\nexplicit lengths.\n\n## API surface\n\n`spawn sqlite.Db { path: filename }` opens (or creates) the database file at\n`path`; pass `\":memory:\"` for an in-process database. `Db` is an actor — every\ncall below is made with `db.<method>(...)`.\n\n| Method | Returns | Notes |\n| --- | --- | --- |\n| `execute(sql: string)` | `i64 fails SqliteError` | Runs a statement with no `?` placeholders; the `i64` is the affected row count. |\n| `execute_params(sql: string, params: Vec<Param>)` | `i64 fails SqliteError` | Same as `execute`, with typed `?` bindings. |\n| `query(sql: string)` | `QueryResult fails SqliteError` | Runs a `SELECT` with no placeholders. |\n| `query_params(sql: string, params: Vec<Param>)` | `QueryResult fails SqliteError` | Same as `query`, with typed `?` bindings. |\n| `stop(db); stopped(db);` | — | Gracefully stops the actor and waits for native connection cleanup. |\n\nPublic types, with `QueryResult`, `Row` and `CellValue` from `hew.db.sql`:\n\n- `QueryResult { columns: Vec<string>; rows: Vec<Row>; }`\n- `Row { values: Vec<CellValue>; }`\n- `CellValue` — `.Text(bytes)` or `.Null`\n- `SqliteError` — `.Open`, `.InvalidInput`, `.Query`, `.Closed`, `.Internal`, each carrying a `string` message\n- `error_message(error: SqliteError) -> string` — extracts the message from any `SqliteError` variant\n"},"version":{"name":"hew/db/sqlite","vers":"0.7.2","deps":[{"name":"hew.db.sql","req":"0.7.0","features":[],"optional":false,"default_features":true}],"features":{},"cksum":"sha256:a31b487717a1084322ce5c1c6dccd816eefe0779e10ee55e073f8bb0926a24b6","sig":"ed25519:9778635d5c1e500146699d948c14fd8fe72161de4864d970a0b1b8b270d26c115c38f583158b1e5ada345fe780100717500bcccbd7bb84283186246934d9be05","key_fp":"SHA256:vkO7V1p3cCOVINfcMAEcuY77sokKlwFJ9Av3WsHRDgQ","yanked":false,"edition":"2026","hew":">=0.10.0, <0.12.0","registry_sig":"ed25519:ec1a9747dc59571fb1bdc45aafc0adb37f05cd88df3f863bf7969d37f493045acc1bfaea5e5ac8d304dc5ab6d4762b8592db9a0e6fbaa34a098365dc184e950e","registry_key_fp":"SHA256:NR2yrof9/ZWkCWyhDODRU8Yvm9Lob/0yYVTdCKzMHb8","published_at":"2026-11-21T21:55:21.025Z","dl":"https://cdn.hewpkg.com/tarballs/hew/db/sqlite/0.7.2.tar.zst"}}