Load-time registry of report definitions.
The registry is mutable process state, so it lives in the shell — the core
(boundary.reports.core.report) stays pure (report logic only). Definitions
are registered at namespace load via the defreport macro and read at
runtime by the report service/adapters.
Load-time registry of report definitions. The registry is mutable process state, so it lives in the shell — the core (boundary.reports.core.report) stays pure (report logic only). Definitions are registered at namespace load via the `defreport` macro and read at runtime by the report service/adapters.
(clear-registry!)Reset the registry to an empty map.
Use in tests to avoid inter-test pollution.
Reset the registry to an empty map. Use in tests to avoid inter-test pollution.
(defreport sym definition-map)Define and register a report.
The body is a map literal that must satisfy ReportDefinition schema.
After macro expansion the definition is automatically registered in the
in-process registry so it is available via get-report.
Example (PDF with template fn):
(defreport invoice-report {:id :invoice-report :type :pdf :page-size :a4 :filename "invoice.pdf" :template (fn [data] [:html [:body [:h1 "Invoice #" (:invoice-number data)] [:p "Total: " (:total data)]]])})
Example (Excel with declarative sections):
(defreport sales-report {:id :sales-report :type :excel :filename "sales.xlsx" :sections [{:type :table :columns [{:key :name :label "Product"} {:key :qty :label "Qty" :format :number} {:key :price :label "Price" :format :currency}]}]})
The var invoice-report is bound to the definition map.
The report is registered under :invoice-report.
Define and register a report.
The body is a map literal that must satisfy ReportDefinition schema.
After macro expansion the definition is automatically registered in the
in-process registry so it is available via `get-report`.
Example (PDF with template fn):
(defreport invoice-report
{:id :invoice-report
:type :pdf
:page-size :a4
:filename "invoice.pdf"
:template (fn [data]
[:html
[:body
[:h1 "Invoice #" (:invoice-number data)]
[:p "Total: " (:total data)]]])})
Example (Excel with declarative sections):
(defreport sales-report
{:id :sales-report
:type :excel
:filename "sales.xlsx"
:sections [{:type :table
:columns [{:key :name :label "Product"}
{:key :qty :label "Qty" :format :number}
{:key :price :label "Price" :format :currency}]}]})
The var `invoice-report` is bound to the definition map.
The report is registered under :invoice-report.(get-report id)Look up a report definition by id.
Returns the definition map or nil if not found.
Look up a report definition by id. Returns the definition map or nil if not found.
(list-reports)Return a vector of all registered report ids.
Return a vector of all registered report ids.
(register-report! definition)Register a report definition in the in-process registry.
Args: definition - ReportDefinition map
Returns the definition map.
Register a report definition in the in-process registry. Args: definition - ReportDefinition map Returns the definition map.
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 |