{"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.4.1","deps":[{"name":"hew.db.sql","req":"0.4.1","features":[],"optional":false,"default_features":true}],"features":{},"cksum":"sha256:cfabded443456294375eac7348d2f291b97e7f26d1f2bb62f551670606de3bb0","sig":"ed25519:68e83a04db4591d137b7415dd00d4ed3995f30ac5df14ed774c0e05cd999ef91201d42da8acc0bead3ab40e9e38a70d70cd71f7d124f2292b4854983cc2a5c02","key_fp":"SHA256:gk8UzG1JaUDuLgtKkCWyxdIF7vtNvUrDqykgv3ZwQTo","yanked":false,"edition":"2026","hew":">=0.6.2, <0.8.0","registry_sig":"ed25519:9926f70e30b93d50024807b698c18d6f95700dc0513ba55fc60eefff7b6963f5bf43896ea0d2cff2985d7d0650fb1725c4cf907758f309bc406fbdc41f3f4e03","registry_key_fp":"SHA256:NR2yrof9/ZWkCWyhDODRU8Yvm9Lob/0yYVTdCKzMHb8","published_at":"2026-10-22T10:01:23.942Z","dl":"https://cdn.hewpkg.com/tarballs/hew/db/sqlite/0.4.1.tar.zst"}}