Liking cljdoc? Tell your friends :D

com.github.ivarref.clj-paginate


ensure-orderclj

(ensure-order src-vec dst-vec & {:keys [sif dif] :or {sif :id dif :id}})
source

get-contextclj

(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
sourceraw docstring

paginateclj

(paginate data
          sort-attrs
          f
          opts
          &
          {:keys [time-filter context batch?]
           :or {time-filter (constantly true) context {} batch? false}})

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}}

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}}
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close