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

prepare-paginateclj

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

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

× close