warnings, more tidying up

This commit is contained in:
parsonsmatt 2020-10-29 07:43:05 -06:00
parent 17b0da892f
commit 34ae916bf6
6 changed files with 182 additions and 176 deletions

View File

@ -61,10 +61,18 @@ library
, transformers >=0.2 , transformers >=0.2
, unliftio , unliftio
, unordered-containers >=0.2 , unordered-containers >=0.2
if impl(ghc >=8.0) ghc-options:
ghc-options: -Wall -Wno-redundant-constraints -Wall
else -Wno-redundant-constraints
ghc-options: -Wall -Wincomplete-uni-patterns
-Wincomplete-record-updates
-Wpartial-fields
-Wmissing-home-modules
-Widentities
-Wredundant-constraints
-Wcpp-undef
-Wcpp-undef
-Wmonomorphism-restriction
default-language: Haskell2010 default-language: Haskell2010
test-suite mysql test-suite mysql

View File

@ -560,10 +560,23 @@ e ^. field
case e of case e of
EEntity ident -> ident EEntity ident -> ident
EAliasedEntity baseI _ -> baseI EAliasedEntity baseI _ -> baseI
EAliasedEntityReference a b ->
error $ unwords
[ "Used (^.) with an EAliasedEntityReference."
, "Please file this as an Esqueleto bug."
, "EAliasedEntityReference", show a, show b
]
fieldIdent = fieldIdent =
case e of case e of
EEntity _ -> fromDBName info (fieldDB fieldDef) EEntity _ -> fromDBName info (fieldDB fieldDef)
EAliasedEntity baseI _ -> useIdent info $ aliasedEntityColumnIdent baseI fieldDef EAliasedEntity baseI _ -> useIdent info $ aliasedEntityColumnIdent baseI fieldDef
EAliasedEntityReference a b ->
error $ unwords
[ "Used (^.) with an EAliasedEntityReference."
, "Please file this as an Esqueleto bug."
, "EAliasedEntityReference", show a, show b
]
-- | Project an SqlExpression that may be null, guarding against null cases. -- | Project an SqlExpression that may be null, guarding against null cases.
withNonNull withNonNull

View File

@ -7,9 +7,8 @@ module Database.Esqueleto.MySQL
( random_ ( random_
) where ) where
import Database.Esqueleto.Internal.Language hiding (random_) import Database.Esqueleto.Internal.Internal hiding (random_)
import Database.Esqueleto.Internal.PersistentImport import Database.Esqueleto.Internal.PersistentImport
import Database.Esqueleto.Internal.Sql
-- | (@random()@) Split out into database specific modules -- | (@random()@) Split out into database specific modules
-- because MySQL uses `rand()`. -- because MySQL uses `rand()`.

View File

@ -43,22 +43,8 @@ import Data.List.NonEmpty (NonEmpty((:|)))
import Data.Proxy (Proxy(..)) import Data.Proxy (Proxy(..))
import qualified Data.Text.Internal.Builder as TLB import qualified Data.Text.Internal.Builder as TLB
import Data.Time.Clock (UTCTime) import Data.Time.Clock (UTCTime)
import Database.Esqueleto.Internal.Internal import Database.Esqueleto.Internal.Internal hiding (random_)
( CompositeKeyError(..)
, EsqueletoError(..)
, FinalResult(..)
, Ident(..)
, KnowResult
, SetClause
, UnexpectedCaseError(..)
, UnexpectedValueError(..)
, renderUpdates
, toUniqueDef
, uncommas
)
import Database.Esqueleto.Internal.Language hiding (random_)
import Database.Esqueleto.Internal.PersistentImport hiding (upsert, upsertBy) import Database.Esqueleto.Internal.PersistentImport hiding (upsert, upsertBy)
import Database.Esqueleto.Internal.Sql
import Database.Persist.Class (OnlyOneUniqueKey) import Database.Persist.Class (OnlyOneUniqueKey)
-- | (@random()@) Split out into database specific modules -- | (@random()@) Split out into database specific modules

View File

@ -1,14 +1,14 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
-- | This module contain SQLite-specific functions. -- | This module contain SQLite-specific functions.
-- --
-- /Since: 2.2.8/ -- @since 2.2.8
module Database.Esqueleto.SQLite module Database.Esqueleto.SQLite
( random_ ( random_
) where ) where
import Database.Esqueleto.Internal.Language hiding (random_) import Database.Esqueleto.Internal.Internal hiding (random_)
import Database.Esqueleto.Internal.PersistentImport import Database.Esqueleto.Internal.PersistentImport
import Database.Esqueleto.Internal.Sql
-- | (@random()@) Split out into database specific modules -- | (@random()@) Split out into database specific modules
-- because MySQL uses `rand()`. -- because MySQL uses `rand()`.

View File

@ -1865,18 +1865,18 @@ testRenderSql run = do
expr `shouldBe` "? = ?" expr `shouldBe` "? = ?"
describe "EEntity Ident behavior" $ do describe "EEntity Ident behavior" $ do
let let render :: SqlExpr (Entity val) -> Text.Text
render :: SqlExpr (Entity val) -> Text.Text
render (EI.EEntity (EI.I ident)) = ident render (EI.EEntity (EI.I ident)) = ident
it "renders sensibly" $ do render _ = error "guess we gotta handle this in the test suite now"
results <- run $ do it "renders sensibly" $ run $ do
_ <- insert $ Foo 2 _ <- insert $ Foo 2
_ <- insert $ Foo 3 _ <- insert $ Foo 3
_ <- insert $ Person "hello" Nothing Nothing 3 _ <- insert $ Person "hello" Nothing Nothing 3
select $ results <- select $
from $ \(a `LeftOuterJoin` b) -> do from $ \(a `LeftOuterJoin` b) -> do
on $ a ^. FooName ==. b ^. PersonFavNum on $ a ^. FooName ==. b ^. PersonFavNum
pure (val (render a), val (render b)) pure (val (render a), val (render b))
liftIO $
head results head results
`shouldBe` `shouldBe`
(Value "Foo", Value "Person") (Value "Foo", Value "Person")