{"metadata":{"name":"hew/db/postgres","vers":"0.7.2","description":"Actor-owned PostgreSQL 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","postgres","sql"],"repository":"https://github.com/hew-lang/ecosystem","edition":"2026","hew":">=0.10.0, <0.12.0","readme":"# hew.db.postgres\n\n`hew.db.postgres` owns each PostgreSQL connection in an actor. Operations\nfail with a typed `PostgresError`, which a call reports as\n`.Err(.Failed(error))`; query replies are immutable wire-safe snapshots,\nand SQL `NULL` is represented by `CellValue.Null`. `QueryResult`, `Row` and\n`CellValue` come from [`hew.db.sql`](../sql/README.md), shared with SQLite and\nMySQL.\n\nThe package wraps the native Rust `postgres` crate over a C ABI: cell values\ncross that boundary as UTF-8 `bytes` text snapshots, not typed columns.\n\n```hew\nimport hew.db.postgres;\nimport std.encoding.utf8;\n\nfn main() {\n    let db = spawn postgres.Conn { connstr: \"host=127.0.0.1 user=hew password=hew dbname=hew_test\" };\n    match db.query(\"SELECT 41::bigint AS value\") {\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(postgres.error_message(error)),\n        .Err(_) => println(\"PostgreSQL actor stopped before replying\"),\n    }\n    stop(db);\n    stopped(db);\n}\n```\n\nThe checked example lives at [`examples/basic.hew`](examples/basic.hew). With\nPostgreSQL listening locally and the `hew_test` database/user configured, run it\nfrom the ecosystem checkout:\n\n```sh\nhew run --pkg-path . db/postgres/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"},"version":{"name":"hew/db/postgres","vers":"0.7.0-rc2","deps":[{"name":"hew.db.sql","req":"0.7.0-rc2","features":[],"optional":false,"default_features":true}],"features":{},"cksum":"sha256:1f23d364c9cd3002cd757421df57d8210a79f6667f12f7f3f01e03570810a793","sig":"ed25519:0b111f07f600afd8da6c35e6af29e61151f3e884f3b25117797a40d6b6afdd5047ca55dbdd2c670f68d426c045f691b735f13776d165d2a46d9f66900deff60d","key_fp":"SHA256:sFX33aRocZfvHKm7NmU4zQHnCoCP32v1uTkJhbVQAWM","yanked":false,"edition":"2026","hew":">=0.10.0, <0.11.0","registry_sig":"ed25519:7e341c1e8283e5ee922c8c283367f5681c47c36d83f58c2bd01672138fcf24a8838575e0b945d5ecc4e85b1519c07074e686fca7101bb30f97fc2e8f2b119b0f","registry_key_fp":"SHA256:NR2yrof9/ZWkCWyhDODRU8Yvm9Lob/0yYVTdCKzMHb8","published_at":"2026-11-11T11:35:04.569Z","dl":"https://cdn.hewpkg.com/tarballs/hew/db/postgres/0.7.0-rc2.tar.zst"}}