Repository navigation
A typed C# predicate on generated types, and the Postgres it becomes #101
monsieurleberre
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
One thing I find handy in the SDK: the type you submit with is the type you query with.
Canton.Ledger.Pqs.Clienttakes a C# expression over the generated bindings and compiles it into a parameterized predicate on PQS'spayloadJSON.Here is a query against the Token Standard V2 demo's
Assettemplate (generated bydpm codegen-cs), run on a local LocalNet 0.9.1-1 with PQS:With Npgsql logging switched on, this is the statement that went to Postgres:
And the rows, decoded back into
Asset:The field names come from the generated record, so a rename in Daml is a compile error rather than a silent empty result. Values are always parameters, and
Amount >= 10mis cast tonumericbecause the compiler knows the field is a DamlNumeric.The client does not expose the SQL itself, so I read it from Npgsql's debug log via a registered
NpgsqlDataSource. Comparisons, nested records,Optional, lists and maps are supported; the PQS client README lists them.Tell us which predicates you'd like to see next.
All reactions