yesod-page-cursor-2.0.0.10
Safe HaskellNone
LanguageHaskell2010

Yesod.Page

Synopsis

Documentation

withPageLink Source #

Arguments

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

Default limit if not specified in the Cursor

Must be a positive natural number.

-> (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 [a] 

withPage and adding pagination data to a Link response header

withPage Source #

Arguments

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

Default limit if not specified in the Cursor

Must be a positive natural number.

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

Instances details
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

Instances details
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] #