Expand description
opys stats — render the project’s configured [[stats]] sections. Each
stat is a single SQL query (sql) run against an in-memory, throwaway
relational view of the corpus (tables docs, tags, sections, fields);
its result set is rendered as a markdown table. Pure read; no feature/type
special-casing. The SQL engine is GlueSQL (pure Rust, in-memory).
Functions§
- build_
db - Materialize
corpusinto a fresh in-memory database (the four corpus tables). - corpus_
json - The corpus projection: a JSON array with one object per live document. This is the intermediate the relational tables are materialized from.
- render_
all - Render every configured stat over
docs, concatenated with a blank line between sections. The corpus DB is built once and reused.Errcarries the first failing stat’s problem message. - render_
stat - Render one stat over
corpus(builds a DB just for it). Convenience for config-time validation over an empty corpus. - render_
stat_ on - Run one stat against an already-built corpus DB and format the result — as a
markdown table, or through the stat’s row
templatewhen set. Returns a human-readable problem (prefixed with the stat name) on failure. Used byrender_alland byverify. - run
Type Aliases§
- Corpus
Db - An in-memory corpus database. Built once per
opys stats/verifyrun and reused across every stat — materializing (and re-parsing the INSERT DML) once per stat would be needless O(stats × corpus) work.