1
1
{-# LANGUAGE CPP #-}
2
2
{-# LANGUAGE UndecidableInstances #-}
3
- {-# LANGUAGE CPP #-}
4
3
5
4
module Database.Beam.Query.Combinators
6
5
( -- * Various SQL functions and constructs
@@ -330,6 +329,8 @@ nub_ :: ( BeamSqlBackend be, Projectible be r )
330
329
nub_ (Q sub) = Q $ liftF (QDistinct (\ _ _ -> setQuantifierDistinct) sub id )
331
330
332
331
-- | Limit the number of results returned by a query.
332
+ --
333
+ -- See also `limitMaybe_` to conditionally apply a limit.
333
334
limit_ :: forall s a be db
334
335
. ( Projectible be a
335
336
, ThreadRewritable (QNested s ) a )
@@ -338,6 +339,8 @@ limit_ limit' (Q q) =
338
339
Q (liftF (QLimit limit' q (rewriteThread (Proxy @ s ))))
339
340
340
341
-- | Conditionally limit the number of results returned by a query.
342
+ --
343
+ -- @since 0.10.4.0
341
344
limitMaybe_ :: forall s a be db
342
345
. ( Projectible be a
343
346
, ThreadRewritable (QNested s ) a )
@@ -348,15 +351,19 @@ limitMaybe_ (Just limit') (Q q) =
348
351
-- See discussion on https://github.com/haskell-beam/beam/pull/633.
349
352
limitMaybe_ Nothing (Q q) = Q (unsafeCoerce q)
350
353
351
- -- | Drop the first `offset'` results.
354
+ -- | Drop the first `offset` results.
355
+ --
356
+ -- See also `offsetMaybe_` to conditionally apply an offset
352
357
offset_ :: forall s a be db
353
358
. ( Projectible be a
354
359
, ThreadRewritable (QNested s ) a )
355
360
=> Integer -> Q be db (QNested s ) a -> Q be db s (WithRewrittenThread (QNested s ) s a )
356
361
offset_ offset' (Q q) =
357
362
Q (liftF (QOffset offset' q (rewriteThread (Proxy @ s ))))
358
363
359
- -- | Conditionally drop the first `offset'` results.
364
+ -- | Conditionally drop the first `offset` results.
365
+ --
366
+ -- @since 0.10.4.0
360
367
offsetMaybe_ :: forall s a be db
361
368
. ( Projectible be a
362
369
, ThreadRewritable (QNested s ) a )
0 commit comments