cratestack-pg
The server-side facade for CrateStack: Postgres (via sqlx), Axum HTTP
bindings, the generated Rust client runtime, and the shared schema /
parser / policy / SQL surface.
When to use this crate
Pick cratestack-pg for backend services: HTTP servers, background
workers, anything that needs the sqlx Postgres runtime, generated Axum
routes, or the in-process generated Rust client.
For embedded / mobile / wasm targets (rusqlite, SQLite, wasm32), depend
on cratestack-sqlite instead. The two crates
are strictly disjoint by design — cratestack-pg does not pull in
libsqlite3-sys, which lets you depend on the official sqlx umbrella
crate alongside it without tripping Cargo's links = "sqlite3"
collision rule.
Installation
Schema macros emit ::cratestack::* paths. Alias this crate as
cratestack via Cargo's package = field:
[]
= { = "cratestack-pg", = "0.4" }
Then in code:
include_server_schema!;
SQL views
This facade re-exports ViewDelegate and ViewDelegateNoUnique — the
read-only delegates handed out by runtime.views().<view_snake>()
for every view block in the schema. ViewDelegate exposes
find_many + find_unique and, on @@materialized views, a
refresh() method that runs REFRESH MATERIALIZED VIEW CONCURRENTLY.
ViewDelegateNoUnique (for @@no_unique views) exposes only
find_many — find_unique and refresh() are absent at the type
level. See the Views reference
and ADR-0003.
Features
decimal-rust-decimal(default) —Decimalcolumns userust_decimal.decimal-bigdecimal— alternativebigdecimalbackend.crypto-aws-lc-rs— opt into theaws-lc-rsrustls provider for FIPS-validated deployments. Seeinstall_fips_crypto_provider().