1module Rel8.Query.Filter
8import Prelude hiding ( filter )
11import qualified Opaleye.Operators as Opaleye
14import Data.Profunctor ( lmap )
17import Rel8.Expr ( Expr )
18import Rel8.Expr.Opaleye ( toColumn, toPrimExpr )
19import Rel8.Query ( Query )
20import Rel8.Query.Opaleye ( fromOpaleye )
23filter :: (a -> Expr Bool) -> a -> Query a
24filter f a = a <$ where_ (f a)
27-- | Drop any rows that don't match a predicate. @where_ expr@ is equivalent
28-- to the SQL @WHERE expr@.
32-- x <- values [ lit x | x <- [ 1..5 :: Int32 ] ]
37where_ :: Expr Bool -> Query ()
39 fromOpaleye $ lmap (\_ -> toColumn $ toPrimExpr condition) Opaleye.restrict
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list