Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- withPageLink :: (MonadHandler m, ToJSON position, FromJSON position, RenderRoute (HandlerSite m)) => Int -> (a -> position) -> (Cursor position -> m [a]) -> m [a]
- withPageLinkAbsolute :: (MonadHandler m, ToJSON position, FromJSON position, Yesod (HandlerSite m), RenderRoute (HandlerSite m)) => Int -> (a -> position) -> (Cursor position -> m [a]) -> m [a]
- withPage :: (MonadHandler m, ToJSON position, FromJSON position, RenderRoute (HandlerSite m)) => Int -> (a -> position) -> (Cursor position -> m [a]) -> m (Page a)
- withPageAbsolute :: (MonadHandler m, ToJSON position, FromJSON position, Yesod (HandlerSite m), RenderRoute (HandlerSite m)) => Int -> (a -> position) -> (Cursor position -> m [a]) -> m (Page a)
- data Page a = Page {}
- data Cursor position = Cursor {
- cursorRoute :: RenderedRoute
- cursorPosition :: Position position
- cursorLimit :: Limit
- data Position position
- data Limit
- unLimit :: Limit -> Int
Documentation
:: (MonadHandler m, ToJSON position, FromJSON position, RenderRoute (HandlerSite m)) | |
=> Int | Default limit if not specified in the Must be a positive natural number. |
-> (a -> position) | How to get an item's position For example, this would be |
-> (Cursor position -> m [a]) | How to fetch one page of data at the given |
-> m [a] |
and adding pagination data to a withPage
Link
response header
Links added by this function are relative. See withPageLinkAbsolute
.
:: (MonadHandler m, ToJSON position, FromJSON position, Yesod (HandlerSite m), RenderRoute (HandlerSite m)) | |
=> Int | Default limit if not specified in the Must be a positive natural number. |
-> (a -> position) | How to get an item's position For example, this would be |
-> (Cursor position -> m [a]) | How to fetch one page of data at the given |
-> m [a] |
and adding pagination data to a withPage
Link
response header
If you've set an approot
, links added by this function will be absolute
using it. If not, this function will be equivalent to withPageLink
.
:: (MonadHandler m, ToJSON position, FromJSON position, RenderRoute (HandlerSite m)) | |
=> Int | Default limit if not specified in the Must be a positive natural number. |
-> (a -> position) | How to get an item's position For example, this would be |
-> (Cursor position -> m [a]) | How to fetch one page of data at the given |
-> m (Page a) |
Paginate data and construct a Page
object.
Links added by this function are relative. See withPageAbsolute
.
:: (MonadHandler m, ToJSON position, FromJSON position, Yesod (HandlerSite m), RenderRoute (HandlerSite m)) | |
=> Int | Default limit if not specified in the Must be a positive natural number. |
-> (a -> position) | How to get an item's position For example, this would be |
-> (Cursor position -> m [a]) | How to fetch one page of data at the given |
-> m (Page a) |
Page | |
|
An encoding of the position in a page
A Cursor encodes all necessary information to determine the position in a specific page.
Cursor | |
|