This note records the current decision around generated count queries and why
bisql does not introduce a new scalar return contract yet.
:cardinality metadata with :one and :many.count queries as ordinary one-row queries.SELECT COUNT(*) AS count ... and return the usual row map shape.Example:
/*:name crud.count-by-state */
/*:cardinality :one */
SELECT COUNT(*) AS count
FROM orders
WHERE state = /*$state*/'sample'
This means the runtime result remains consistent with the current adapter model:
{:count 42}
:scalar YetWe considered introducing a separate scalar return contract, but that quickly expands into a larger result-shape design problem:
0 or 1 value1 value0..n values1..n values0 or 1 row1 row0..n rows1..n rowsThat is a broader contract system than the current :one / :many split.
There is also an ambiguity problem:
NULLIf a scalar API returned nil for both, those cases would be indistinguishable.
That kind of result-shape contract is better handled together with future schema or output validation work, especially Malli integration.
At that point, bisql can decide whether it needs concepts such as:
and how strict each contract should be.
For now, count remains intentionally simple:
countCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |