Paginator enables paginating multiple concurrent items with batching.
Paginator enables paginating multiple concurrent items with batching.
(async-fn f max-concurrency)
Helper to wrap a function into one that executes async in 'future', with concurrency limited to concurrency. The returned fn has semaphone object in meta.
If you pass another fn created by this function as concurrency, the returned function will share the concurrency limit with the other one.
Helper to wrap a function into one that executes async in 'future', with concurrency limited to concurrency. The returned fn has semaphone object in meta. If you pass another fn created by this function as concurrency, the returned function will share the concurrency limit with the other one.
(batcher batch-size)
(batcher batch-size partial-batch-strategy)
Create batcher with parameters:
Create batcher with parameters: - batch size - partial-batch-strategy (can be nil, :min-batches, or map of factors)
(extra-props paging-state)
Returns map of extra properties on a PagingState, also works with maps
Returns map of extra properties on a PagingState, also works with maps
(grouped-batcher group-fn batch-size)
(grouped-batcher group-fn batch-size partial-batch-strategy)
Create a batcher that groups by provided function. Returns batches of size n from each group as it fills up. Group fn receives a PagingState, and it should return the group.
Partial batch strategy can be nil or :min-batches of a map of factors.
Create a batcher that groups by provided function. Returns batches of size n from each group as it fills up. Group fn receives a PagingState, and it should return the group. Partial batch strategy can be nil or :min-batches of a map of factors.
(paginate! run-fn {:keys [batcher pages? concurrency] :as options} input)
Paginates a collection of items using run-fn.
Paginates a collection of items using run-fn.
(paginate-one! run-fn)
(paginate-one! input run-fn)
(paginate-one! input run-fn {:keys [pages?] :as options})
Paginates one item, using run-fn. Returns a sequence of maps, one for each item with merged properties from input into each.
Paginates one item, using run-fn. Returns a sequence of maps, one for each item with merged properties from input into each. - input is a map, is converted to PagingState - run-fn can return a PagingState, a map (which will be converted to paging state) or Future or IPending - options: :paged?, if set to true the function returns a lazy sequence of PagingStates, one for each page as it gets loaded
(unwrap paging-state)
Unwraps PagingState, returns vector of items, where each item has extra props from PagingState added. If items are not maps an exception will be thrown.
Unwraps PagingState, returns vector of items, where each item has extra props from PagingState added. If items are not maps an exception will be thrown.
(unwrap-async fut)
Unwraps async result from async-fn (or other such mechanism), catching exceptions, unwrapping them and combining stack traces.
Unwraps async result from async-fn (or other such mechanism), catching exceptions, unwrapping them and combining stack traces.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close