(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 prepared
f
opts
&
{:keys [filter context batch?]
:or {filter (constantly true) context {} batch? false}})Paginates the prepared data. Returns a map of {:edges [{:node { ...} :cursor ...} {:node { ...} :cursor ...} ...] :pageInfo {:hasNextPage Boolean :hasPrevPage Boolean :totalCount Integer :startCursor String :endCursor String}}
Required parameters: prepared: The previously prepared data from prepare-paginate.
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: :filter: For a node to be included, this function must return truthy, i.e. any value except nil and false. Defaults to (constantly true).
:context: User-defined data to store in every cursor. Must be pr-str-able. Defaults to {}.
: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.
Paginates the prepared data. Returns a map of
{:edges [{:node { ...}
:cursor ...}
{:node { ...}
:cursor ...}
...]
:pageInfo {:hasNextPage Boolean
:hasPrevPage Boolean
:totalCount Integer
:startCursor String
:endCursor String}}
Required parameters:
prepared: The previously prepared data from prepare-paginate.
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:
:filter: For a node to be included, this function must return truthy, i.e. any value except nil and false.
Defaults to (constantly true).
:context: User-defined data to store in every cursor. Must be pr-str-able.
Defaults to {}.
: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.(prepare-paginate opts coll)Prepares data for pagination. Coll should be a set or a vector.
Opts must contain :sort-by, which should be a vector of keywords that determine the ordering of coll.
Prepares data for pagination. Coll should be a set or a vector. Opts must contain :sort-by, which should be a vector of keywords that determine the ordering of coll.
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 |