canton_pqs/lib.rs
1//! A typed read client for the Daml **Participant Query Store** (PQS, served by
2//! Scribe).
3//!
4//! PQS streams a participant's contracts into Postgres and exposes them through
5//! a small set of functions — `active`, `creates`, `archives`, `exercises`,
6//! `lookup_contract`. This crate reads them typed: a query names its template
7//! by *type*, and the row comes back as the generated payload.
8//!
9//! # No hand-written SQL, and no interpolation
10//!
11//! Predicates compile to parameterized statements. Every caller-supplied value
12//! is a parameter, and so is every JSON field path — sent as `text[]` and
13//! applied with `#>`. The statement text depends on the *shape* of a query and
14//! never on its data, so a field name taken from user input is data Postgres
15//! never parses.
16//!
17//! # The payload is the same type the Ledger API gives you
18//!
19//! PQS stores payloads in the Daml JSON encoding, which is what `canton-daml`
20//! implements — so a contract read here deserializes into the same generated
21//! type as one read from a transaction stream. That is the point of the crate:
22//! two ways in, one set of types.
23
24#![cfg_attr(docsrs, feature(doc_cfg))]
25#![forbid(unsafe_code)]
26
27mod client;
28mod query;
29mod row;
30
31pub use client::{DEFAULT_TIMEOUT, PqsClient, active_signed_by};
32pub use query::{IntoPath, Op, Param, Predicate, Query, Source, Sql};
33pub use row::{Contract, Exercise};