@@ -15,9 +15,19 @@ import Rel8.Query ( Query )
1515import Rel8.Query.Opaleye ( mapOpaleye )
1616
1717
18+-- | @limit n@ select at most @n@ rows from a query. @limit n@ is equivalent
19+-- to the SQL @LIMIT n@.
20+--
21+-- >>> select c $ limit 3 $ values [ lit x | x <- [ 1..5 :: Int32 ] ]
22+-- [1,2,3]
1823limit :: Word -> Query a -> Query a
1924limit = mapOpaleye . Opaleye.limit . fromIntegral
2025
2126
27+-- | @offset n@ drops the first @n@ rows from a query. @offset n@ is equivalent
28+-- to the SQL @OFFSET n@.
29+--
30+-- >>> select c $ offset 3 $ values [ lit x | x <- [ 1..5 :: Int32 ] ]
31+-- [4,5]
2232offset :: Word -> Query a -> Query a
2333offset = mapOpaleye . Opaleye.offset . fromIntegral