Shared helpers for table sorting, pagination, and basic search filters across web UIs.
This namespace centralizes parsing of table-related query parameters so that all modules use the same semantics for sorting and paging. It also provides small helpers for generic search/filter parameters that feature modules can interpret according to their own needs.
TableQuery shape: {:sort :name ; keyword column identifier (or default) :dir :asc ; :asc or :desc :page 1 ; 1-based page index :page-size 20 ; items per page :offset 0 ; derived from page/page-size :limit 20} ; derived from page-size
Shared helpers for table sorting, pagination, and basic search filters across web UIs.
This namespace centralizes parsing of table-related query parameters so that
all modules use the same semantics for sorting and paging. It also provides
small helpers for generic search/filter parameters that feature modules can
interpret according to their own needs.
TableQuery shape:
{:sort :name ; keyword column identifier (or default)
:dir :asc ; :asc or :desc
:page 1 ; 1-based page index
:page-size 20 ; items per page
:offset 0 ; derived from page/page-size
:limit 20} ; derived from page-size
(encode-query-params m)Very small helper to turn a string-keyed map into a query string. Values are stringified with str; caller is responsible for URL encoding if needed (current usages only contain safe characters).
Very small helper to turn a string-keyed map into a query string. Values are stringified with str; caller is responsible for URL encoding if needed (current usages only contain safe characters).
(parse-search-filters query-params)Parse search and filter parameters from query params.
Extracts 'q' (search), 'role', and 'status' from query parameters and filters out blank/empty values.
Args: query-params: String-keyed map of query parameters from Ring
Returns: Map with :q, :role, :status keys (only non-blank values included)
Parse search and filter parameters from query params. Extracts 'q' (search), 'role', and 'status' from query parameters and filters out blank/empty values. Args: query-params: String-keyed map of query parameters from Ring Returns: Map with :q, :role, :status keys (only non-blank values included)
(parse-table-query query-params
{:keys [default-sort default-dir default-page-size]})Parse table-related query params into a normalized TableQuery map.
query-params: raw string-keyed query params from Ring (:query-params).
options: {:default-sort ; required keyword for default sort column :default-dir ; :asc or :desc :default-page-size} ; integer page size when not provided
Returns a map with keys :sort, :dir, :page, :page-size, :offset, :limit.
Parse table-related query params into a normalized TableQuery map.
query-params: raw string-keyed query params from Ring (:query-params).
options: {:default-sort ; required keyword for default sort column
:default-dir ; :asc or :desc
:default-page-size} ; integer page size when not provided
Returns a map with keys :sort, :dir, :page, :page-size, :offset, :limit.
(search-filters->params filters)Convert parsed search/filter map back into a string-keyed param map.
Useful for building combined query strings with table-query->params.
Convert parsed search/filter map back into a string-keyed param map. Useful for building combined query strings with table-query->params.
(table-query->params {:keys [sort dir page page-size]})Convert a TableQuery map into a simple string-keyed param map suitable for building query strings.
Convert a TableQuery map into a simple string-keyed param map suitable for building query strings.
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 |