mirror of
https://github.com/circuithub/rel8.git
synced 2024-10-05 21:29:35 +03:00
Added case_ operator
Add `case_` operator which maps through directly to the opaley `case_` operator.
This commit is contained in:
parent
801d7901d1
commit
99d4a0b9bc
2
Rel8.hs
2
Rel8.hs
@ -91,7 +91,7 @@ module Rel8
|
||||
|
||||
|
||||
-- * TODO Organise
|
||||
, QueryResult, Schema, Anon
|
||||
, QueryResult, Schema, Anon, case_
|
||||
|
||||
-- * Re-exported symbols
|
||||
, Connection, Stream, Of, Generic
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
module Rel8.Internal.Operators where
|
||||
|
||||
import Control.Arrow ((***))
|
||||
import Data.Int (Int16, Int32, Int64)
|
||||
import Data.Text (Text)
|
||||
import Data.Time (UTCTime)
|
||||
@ -86,3 +87,10 @@ instance DBOrd Int64 where
|
||||
instance DBOrd Text where
|
||||
instance DBOrd UTCTime where
|
||||
|
||||
-- | Case statement
|
||||
case_ :: [(Expr Bool, Expr a)] -> Expr a -> Expr a
|
||||
case_ cases defaultCase =
|
||||
columnToExpr
|
||||
(O.case_
|
||||
(map (exprToColumn *** exprToColumn) cases)
|
||||
(exprToColumn defaultCase))
|
||||
|
Loading…
Reference in New Issue
Block a user