yesod-page-cursor-1.0.0.1

Safe HaskellNone
LanguageHaskell2010

Yesod.Page

Synopsis

Documentation

withPageLink :: (MonadHandler m, ToJSON position, FromJSON position, RenderRoute (HandlerSite m)) => (a -> position) -> (Cursor position -> m [a]) -> m [a] Source #

withPage and adding pagination data to a Link response header

withPage Source #

Arguments

:: (MonadHandler m, ToJSON position, FromJSON position, RenderRoute (HandlerSite m)) 
=> (a -> position)

How to get an item's position

For example, this would be entityKey for paginated Entity values.

-> (Cursor position -> m [a])

How to fetch one page of data at the given Cursor

-> m (Page a) 

data Page a Source #

Instances
Functor Page Source # 
Instance details

Defined in Yesod.Page

Methods

fmap :: (a -> b) -> Page a -> Page b #

(<$) :: a -> Page b -> Page a #

ToJSON a => ToJSON (Page a) Source # 
Instance details

Defined in Yesod.Page

data Cursor position Source #

An encoding of the position in a page

A Cursor encodes all necessary information to determine the position in a specific page.

Constructors

Cursor 

Fields

data Position position Source #

Constructors

First 
Next position 
Previous position 
Last 
Instances
ToJSON position => ToJSON (Position position) Source # 
Instance details

Defined in Yesod.Page

Methods

toJSON :: Position position -> Value #

toEncoding :: Position position -> Encoding #

toJSONList :: [Position position] -> Value #

toEncodingList :: [Position position] -> Encoding #

FromJSON position => FromJSON (Position position) Source # 
Instance details

Defined in Yesod.Page

Methods

parseJSON :: Value -> Parser (Position position) #

parseJSONList :: Value -> Parser [Position position] #