(get-context opts)
Gets the :context from a previous invocation of paginate as stored in :before or :after
Gets the :context from a previous invocation of paginate as stored in :before or :after
(paginate data
sort-attrs
f
opts
&
{:keys [time-filter context batch?]
:or {time-filter (constantly true) context {} batch? false}})
data: The data to paginate. Must be either a vector or a map with vectors as values.
All vectors must be sorted according to sort-attrs
.
Elements in the vectors must be maps.
sort-attrs: How the vectors in data
is sorted.
Should be a single keyword or a vector of keywords.
f: Invoked on each node. Invoked once on all nodes if :batch? is true.
opts: A map that should contain :first or :last, as well as optionally :after or :before.
:context: User-defined data to store in every cursor. Must be pr-str-able.
Defaults to {}. Can be retrieved on subsequent queries using
(get-context ...)
.
:batch?: Set to true if f should be invoked once on all nodes, and not once for each node. If this is set to true, f must return the output nodes in the same order as the input nodes. Defaults to false.
The paginated data. Returns a map of {:edges [{:node { ...} :cursor ...} {:node { ...} :cursor ...} ...] :pageInfo {:hasNextPage Boolean :hasPrevPage Boolean :totalCount Integer :startCursor String :endCursor String}}
Required parameters =================== data: The data to paginate. Must be either a vector or a map with vectors as values. All vectors must be sorted according to `sort-attrs`. Elements in the vectors must be maps. sort-attrs: How the vectors in `data` is sorted. Should be a single keyword or a vector of keywords. f: Invoked on each node. Invoked once on all nodes if :batch? is true. opts: A map that should contain :first or :last, as well as optionally :after or :before. Optional named parameters ========================= :context: User-defined data to store in every cursor. Must be pr-str-able. Defaults to {}. Can be retrieved on subsequent queries using `(get-context ...)`. :batch?: Set to true if f should be invoked once on all nodes, and not once for each node. If this is set to true, f must return the output nodes in the same order as the input nodes. Defaults to false. Return value ============ The paginated data. Returns a map of {:edges [{:node { ...} :cursor ...} {:node { ...} :cursor ...} ...] :pageInfo {:hasNextPage Boolean :hasPrevPage Boolean :totalCount Integer :startCursor String :endCursor String}}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close