{"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.1","deps":[{"name":"hew.db.sql","req":"0.7.0","features":[],"optional":false,"default_features":true}],"features":{},"cksum":"sha256:c0e9272a2957dede88c6bfc10828bd82aa72a7b40dac2c68ce451b6e03c21cff","sig":"ed25519:699efdc135e6329ac3f7756bf19d45b3e3d548d21ea0ee16902788108b33139501de9f7103c3c22103591cefb3510047975d47c54770da788102245725d06307","key_fp":"SHA256:jiRoI3zNjRf/jbs3rkssGHT0JSZIte0YQJ/WV2hf5xE","yanked":false,"edition":"2026","hew":">=0.10.0, <0.12.0","registry_sig":"ed25519:3d34973a2c9994d38edd787423e85566f5a2e8a234790b51484abacc72b6401ca8ad9f92c3549e8b4f8585a20dc728b22c9a2bd90f8fe37c15e167630c4f6602","registry_key_fp":"SHA256:NR2yrof9/ZWkCWyhDODRU8Yvm9Lob/0yYVTdCKzMHb8","published_at":"2026-11-19T02:50:40.643Z","dl":"https://cdn.hewpkg.com/tarballs/hew/db/sqlite/0.7.1.tar.zst"}}