mirror of
https://github.com/circuithub/rel8.git
synced 2024-09-12 00:07:34 +03:00
Update my test cases
This commit is contained in:
parent
2262179220
commit
c5e15a005f
@ -15,7 +15,7 @@ import qualified Streaming.Prelude as S
|
||||
import Data.Text (Text)
|
||||
|
||||
data Part f = Part
|
||||
{ partId :: C f "id" 'HasDefault Int
|
||||
{ partId :: C f "id" 'HasDefault Int64
|
||||
, partDescription :: C f "description" 'NoDefault (Maybe Text)
|
||||
} deriving (Generic)
|
||||
|
||||
@ -29,22 +29,34 @@ testQueryApDo :: Stream (Of (Part QueryResult, Part QueryResult)) IO ()
|
||||
testQueryApDo = select testConn $
|
||||
do l <- queryTable
|
||||
r <- queryTable
|
||||
return (l,r)
|
||||
return (l,r)
|
||||
|
||||
test1Col :: Stream (Of (Col Int)) IO ()
|
||||
test1Col :: Stream (Of (Col Int64)) IO ()
|
||||
test1Col = select testConn $
|
||||
proc _ -> do
|
||||
t <- queryTable -< ()
|
||||
returnA -< partId t
|
||||
|
||||
testLeftJoin :: Stream (Of (Part QueryResult, Col (Maybe Int))) IO ()
|
||||
testLeftJoin :: Stream (Of (Part QueryResult, Col (Maybe Int64))) IO ()
|
||||
testLeftJoin =
|
||||
select testConn $
|
||||
fmap (\(l,r) -> (l, r ? partId)) $
|
||||
leftJoin
|
||||
(\l r -> partId l /= partId r)
|
||||
queryTable
|
||||
queryTable
|
||||
leftJoin (\l r -> not (partId l ==. partId r)) queryTable queryTable
|
||||
|
||||
testInlineLeftJoin :: Stream (Of (Part QueryResult, Maybe (Part QueryResult))) IO ()
|
||||
testInlineLeftJoin =
|
||||
select testConn $ proc _ -> do
|
||||
a <- limit 1 queryTable -< ()
|
||||
b <- inlineLeftJoin (limit 1 queryTable) -<
|
||||
\b -> not (partId a ==. partId b)
|
||||
returnA -< (a, b)
|
||||
|
||||
testInlineLeftJoinQ =
|
||||
proc _ -> do
|
||||
a <- limit 1 queryTable -< ()
|
||||
b <- inlineLeftJoin (limit 1 queryTable) -<
|
||||
\b -> not (partId a ==. partId b)
|
||||
returnA -< (a, b)
|
||||
|
||||
testAggregate :: Stream (Of (Col Bool, Col Int64)) IO ()
|
||||
testAggregate = select testConn $ aggregate $ proc _ -> do
|
||||
@ -65,10 +77,10 @@ testInsert =
|
||||
,partDescription = lit (Just "Hello")}]
|
||||
|
||||
testUpdate :: IO Int64
|
||||
testUpdate = update testConn (\Part{..} -> partId == lit 9538091) id
|
||||
testUpdate = update testConn (\Part{..} -> partId ==. lit 9538091) id
|
||||
|
||||
testWhere :: Stream (Of (Col Int)) IO ()
|
||||
testWhere = select testConn $ do
|
||||
testWhere :: Stream (Of (Col Int64)) IO ()
|
||||
testWhere = select testConn $ proc _ -> do
|
||||
Part{..} <- queryTable -< ()
|
||||
where_ -< isNull partDescription
|
||||
return partId
|
||||
returnA -< partId
|
||||
|
Loading…
Reference in New Issue
Block a user