fixup subselectUnsafe test because inference engine doesnt work for it so good
This commit is contained in:
parent
65ac3c7e5a
commit
6a420273c0
@ -55,6 +55,12 @@ type instance MaybeValueTyToMaybeEntityTy (Aggregate (Value (Maybe val))) ent =
|
|||||||
type instance UnMaybeTy (Aggregate (Value (Maybe val))) = Aggregate (Value val)
|
type instance UnMaybeTy (Aggregate (Value (Maybe val))) = Aggregate (Value val)
|
||||||
type instance UnMaybeTy (Aggregate (Maybe (Entity ent))) = Aggregate (Entity ent)
|
type instance UnMaybeTy (Aggregate (Maybe (Entity ent))) = Aggregate (Entity ent)
|
||||||
|
|
||||||
|
test :: (PersistEntity ent, PersistField a, Integral n)
|
||||||
|
=> SqlExpr (Maybe (Entity ent))
|
||||||
|
-> EntityField ent a
|
||||||
|
-> SqlExpr (Value b)
|
||||||
|
-> SqlExpr (Value c)
|
||||||
|
-> SqlQuery (SqlExpr (Value (Maybe a)), SqlExpr (Value b), SqlExpr (Value n), SqlExpr (Value Int))
|
||||||
test ent field y other = do
|
test ent field y other = do
|
||||||
groupBy (ent, y) $ \(ent', y') ->
|
groupBy (ent, y) $ \(ent', y') ->
|
||||||
pure (ent' ?. field, y', sum_ other, countRows_)
|
pure (ent' ?. field, y', sum_ other, countRows_)
|
||||||
|
|||||||
@ -454,10 +454,10 @@ testSubSelect run = do
|
|||||||
eres <- try $ run $ do
|
eres <- try $ run $ do
|
||||||
setup
|
setup
|
||||||
bad <- select $
|
bad <- select $
|
||||||
from $ \n -> do
|
from $ \(n :: SqlExpr (Entity Numbers)) -> do
|
||||||
pure $ (,) (n ^. NumbersInt) $
|
pure $ (,) (n ^. NumbersInt) $
|
||||||
subSelectUnsafe $
|
subSelectUnsafe $
|
||||||
from $ \n' -> do
|
from $ \(n' :: SqlExpr (Entity Numbers)) -> do
|
||||||
pure (just (n' ^. NumbersDouble))
|
pure (just (n' ^. NumbersDouble))
|
||||||
good <- select $
|
good <- select $
|
||||||
from $ \n -> do
|
from $ \n -> do
|
||||||
@ -480,10 +480,10 @@ testSubSelect run = do
|
|||||||
eres <- try $ run $ do
|
eres <- try $ run $ do
|
||||||
setup
|
setup
|
||||||
select $
|
select $
|
||||||
from $ \n -> do
|
from $ \(n :: SqlExpr (Entity Numbers)) -> do
|
||||||
pure $ (,) (n ^. NumbersInt) $
|
pure $ (,) (n ^. NumbersInt) $
|
||||||
subSelectUnsafe $
|
subSelectUnsafe $
|
||||||
from $ \n' -> do
|
from $ \(n' :: SqlExpr (Entity Numbers)) -> do
|
||||||
where_ $ val False
|
where_ $ val False
|
||||||
pure (n' ^. NumbersDouble)
|
pure (n' ^. NumbersDouble)
|
||||||
case eres of
|
case eres of
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user