on da76712 help sign in
rel8/src/Rel8/Query/Limit.hs
27 lines 582 B history raw
1module Rel8.Query.Limit
2 ( limit
3 , offset
4 )
5where
7-- base
8import Prelude
10-- opaleye
11import qualified Opaleye
13-- rel8
14import Rel8.Query ( Query )
15import Rel8.Query.Opaleye ( mapOpaleye )
18-- | @limit n@ select at most @n@ rows from a query. @limit n@ is equivalent
19-- to the SQL @LIMIT n@.
20limit :: Word -> Query a -> Query a
21limit = mapOpaleye . Opaleye.limit . fromIntegral
24-- | @offset n@ drops the first @n@ rows from a query. @offset n@ is equivalent
25-- to the SQL @OFFSET n@.
26offset :: Word -> Query a -> Query a
27offset = mapOpaleye . Opaleye.offset . fromIntegral