Pure report logic: cell/row formatting, section rendering, and report preparation.
The definition registry and the defreport macro live in the shell
(boundary.reports.shell.registry) — this namespace holds no mutable state.
FC/IS rule: no I/O here. All side effects (file writing, HTTP responses, calling :data-source) live in the shell layer.
Pure report logic: cell/row formatting, section rendering, and report preparation. The definition registry and the `defreport` macro live in the shell (boundary.reports.shell.registry) — this namespace holds no mutable state. FC/IS rule: no I/O here. All side effects (file writing, HTTP responses, calling :data-source) live in the shell layer.
(build-sections-hiccup* sections data formatting-context)Build Hiccup from a vector of SectionDef maps and the report data.
Supports section types: :header - renders :content Hiccup as-is inside a [:header ...] :table - renders :columns + data as a table :footer - renders :content Hiccup as-is inside a [:footer ...] :spacer - renders an empty [:div.spacer ...]
Returns: [:html [:head ...] [:body ...]]
Build Hiccup from a vector of SectionDef maps and the report data. Supports section types: :header - renders :content Hiccup as-is inside a [:header ...] :table - renders :columns + data as a table :footer - renders :content Hiccup as-is inside a [:footer ...] :spacer - renders an empty [:div.spacer ...] Returns: [:html [:head ...] [:body ...]]
(build-table-rows* columns data formatting-context)Build a Hiccup [:tbody ...] from a collection of data records and column defs.
Each record becomes a [:tr ...] with one [:td ...] per column. Applies :align as an inline style when present.
Returns: [:tbody [:tr [:td ...] ...] ...]
Build a Hiccup [:tbody ...] from a collection of data records and column defs. Each record becomes a [:tr ...] with one [:td ...] per column. Applies :align as an inline style when present. Returns: [:tbody [:tr [:td ...] ...] ...]
(format-cell* value format-type {:keys [zone-id]})Format a single cell value according to format-type.
Supported format-types: :date - converts java.util.Date / java.time.Instant / LocalDate to ISO string :number - coerces to double, falls back to "" on nil :currency - formats as EUR with thousands separator, e.g. "€ 1.234,56" :string - calls str on value (default) nil - treated as :string
Returns a string or number suitable for use in Hiccup or POI cells.
Format a single cell value according to format-type. Supported format-types: :date - converts java.util.Date / java.time.Instant / LocalDate to ISO string :number - coerces to double, falls back to "" on nil :currency - formats as EUR with thousands separator, e.g. "€ 1.234,56" :string - calls str on value (default) nil - treated as :string Returns a string or number suitable for use in Hiccup or POI cells.
(map-columns* columns record formatting-context)Map a single data record through a vector of ColumnDef maps.
Returns a vector of formatted values in column order.
Example: (map-columns* [{:key :name :label "Name"} {:key :price :label "Price" :format :currency}] {:name "Widget" :price 9.99}) ;=> ["Widget" "€ 9,99"]
Map a single data record through a vector of ColumnDef maps.
Returns a vector of formatted values in column order.
Example:
(map-columns* [{:key :name :label "Name"} {:key :price :label "Price" :format :currency}]
{:name "Widget" :price 9.99})
;=> ["Widget" "€ 9,99"](prepare-report report-def)Validate a report definition and return {:definition ... :errors ...}.
Pure — does NOT call :data-source or generate bytes. Returns: {:definition report-def :valid? true :errors []} {:definition report-def :valid? false :errors [...malli-errors...]}
Validate a report definition and return {:definition ... :errors ...}.
Pure — does NOT call :data-source or generate bytes.
Returns:
{:definition report-def :valid? true :errors []}
{:definition report-def :valid? false :errors [...malli-errors...]}(resolve-data report-def opts)Call the :data-source fn with opts, returning the result. Returns nil if no :data-source is defined.
NOTE: This is a side-effecting call (queries DB, calls API, etc.). It lives here as a named helper so shell code can call it explicitly and tests can stub the :data-source fn.
Call the :data-source fn with opts, returning the result. Returns nil if no :data-source is defined. NOTE: This is a side-effecting call (queries DB, calls API, etc.). It lives here as a named helper so shell code can call it explicitly and tests can stub the :data-source fn.
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 |