on master help sign in
Document where_
b31e84eOllie Charles
src/Rel8/Query/Filter.hs+10
@@ -24,6 +24,16 @@ filter :: (a -> Expr Bool) -> a -> Query a
24filter f a = a <$ where_ (f a)
24filter f a = a <$ where_ (f a)
25
25
26
26
27+-- | Drop any rows that don't match a predicate. @where_ expr@ is equivalent
28+-- to the SQL @WHERE expr@.
29+--
30+-- >>> :{
31+-- select c $ do
32+-- x <- values [ lit x | x <- [ 1..5 :: Int32 ] ]
33+-- where_ $ x >. lit 2
34+-- return x
35+-- :}
36+-- [3,4,5]
27where_ :: Expr Bool -> Query ()
37where_ :: Expr Bool -> Query ()
28where_ condition =
38where_ condition =
29 fromOpaleye $ lmap (\_ -> toColumn $ toPrimExpr condition) Opaleye.restrict
39 fromOpaleye $ lmap (\_ -> toColumn $ toPrimExpr condition) Opaleye.restrict