rds-data 0.1.1.2 → 0.1.1.3
raw patch · 11 files changed
+49/−50 lines, 11 files
Files
- app/App/AWS/Env.hs +14/−13
- app/App/Cli/Run/Down.hs +8/−8
- app/App/Cli/Run/Example.hs +2/−1
- app/App/Cli/Run/LocalStack.hs +2/−1
- app/App/Cli/Run/Up.hs +7/−8
- app/App/Show.hs +0/−10
- rds-data.cabal +3/−2
- src/Data/RdsData/Decode/Row.hs +5/−4
- src/Data/RdsData/Decode/Value.hs +3/−2
- src/Data/RdsData/Internal/Show.hs +5/−0
- src/Data/RdsData/Orphans.hs +0/−1
app/App/AWS/Env.hs view
@@ -1,7 +1,7 @@-{-# LANGUAGE BlockArguments #-}-{-# LANGUAGE DataKinds #-}+{-# LANGUAGE BlockArguments #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeApplications #-} module App.AWS.Env ( awsLogger@@ -10,23 +10,24 @@ , setEnvEndpoint ) where -import App.Show (tshow)-import Control.Concurrent (myThreadId)-import Control.Monad (when, forM_)-import Data.ByteString (ByteString)-import Data.ByteString.Builder (toLazyByteString)-import Data.Function ((&))-import Data.Generics.Product.Any (the)-import Lens.Micro ((.~), (%~))-import Network.HTTP.Client (HttpException (..), HttpExceptionContent (..))+import Control.Concurrent (myThreadId)+import Control.Monad (forM_, when)+import Data.ByteString (ByteString)+import Data.ByteString.Builder (toLazyByteString)+import Data.Function ((&))+import Data.Generics.Product.Any (the)+import Data.RdsData.Internal.Show (tshow)+import Lens.Micro ((%~), (.~))+import Network.HTTP.Client (HttpException (..),+ HttpExceptionContent (..)) import qualified Amazonka as AWS+import qualified App.Console as CIO import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy as LBS import qualified Data.ByteString.Lazy.Char8 as LC8 import qualified Data.Text.Encoding as T-import qualified App.Console as CIO import qualified System.IO as IO setEnvEndpoint :: Maybe (ByteString, Int, Bool) -> IO AWS.Env -> IO AWS.Env
app/App/Cli/Run/Down.hs view
@@ -19,10 +19,10 @@ import qualified App.Cli.Types as CLI import qualified App.Console as T import Data.RdsData.Aws+import Data.RdsData.Internal.Show import Data.RdsData.Polysemy.Core import Data.RdsData.Polysemy.Error import Data.RdsData.Polysemy.Migration-import qualified Data.Text as T import HaskellWorks.Polysemy import HaskellWorks.Polysemy.Amazonka import HaskellWorks.Polysemy.File@@ -73,12 +73,12 @@ runDownCmd :: CLI.DownCmd -> IO () runDownCmd cmd = runApp cmd do initialiseDb- & trap @AWS.Error (throw . AppError . T.pack . show)- & trap @RdsDataError (throw . AppError . T.pack . show)+ & trap @AWS.Error (throw . AppError . tshow)+ & trap @RdsDataError (throw . AppError . tshow) migrateDown (cmd ^. the @"migrationFp")- & trap @AWS.Error (throw . AppError . T.pack . show)- & trap @IOException (throw . AppError . T.pack . show)- & trap @JsonDecodeError (throw . AppError . T.pack . show)- & trap @RdsDataError (throw . AppError . T.pack . show)- & trap @YamlDecodeError (throw . AppError . T.pack . show)+ & trap @AWS.Error (throw . AppError . tshow)+ & trap @IOException (throw . AppError . tshow)+ & trap @JsonDecodeError (throw . AppError . tshow)+ & trap @RdsDataError (throw . AppError . tshow)+ & trap @YamlDecodeError (throw . AppError . tshow)
app/App/Cli/Run/Example.hs view
@@ -19,6 +19,7 @@ import Data.Int import Data.Maybe import Data.Monoid+import Data.RdsData.Internal.Show import Data.RdsData.Types import Data.Text (Text) import Data.Time@@ -242,7 +243,7 @@ ) ] - liftIO $ IO.putStrLn $ "===> " <> show req+ liftIO $ T.putStrLn $ "===> " <> tshow req res <- AWS.send envAws req
app/App/Cli/Run/LocalStack.hs view
@@ -27,6 +27,7 @@ import Data.Generics.Product.Any import Data.RdsData.Aws import Data.RdsData.Default+import Data.RdsData.Internal.Show import Data.RdsData.Polysemy.Test.Cluster import Data.RdsData.Polysemy.Test.Env import GHC.IORef (IORef)@@ -118,7 +119,7 @@ lsEp <- getLocalStackEndpoint container jotShow_ lsEp -- Localstack endpoint let port = lsEp ^. the @"port"- let exampleCmd = "awslocal --endpoint-url=http://localhost:" <> show port <> " s3 ls"+ let exampleCmd = "awslocal --endpoint-url=http://localhost:" <> tshow port <> " s3 ls" -- Example awslocal command: jot_ exampleCmd jotShowM_ $ ask @StatementContext
app/App/Cli/Run/Up.hs view
@@ -20,7 +20,6 @@ import Data.RdsData.Polysemy.Core import Data.RdsData.Polysemy.Error import Data.RdsData.Polysemy.Migration-import qualified Data.Text as T import HaskellWorks.Polysemy import HaskellWorks.Polysemy.Amazonka import HaskellWorks.Polysemy.File@@ -71,12 +70,12 @@ runUpCmd :: CLI.UpCmd -> IO () runUpCmd cmd = runApp cmd do initialiseDb- & trap @AWS.Error (throw . AppError . T.pack . show)- & trap @RdsDataError (throw . AppError . T.pack . show)+ & trap @AWS.Error (throw . AppError . tshow)+ & trap @RdsDataError (throw . AppError . tshow) migrateUp (cmd ^. the @"migrationFp")- & trap @AWS.Error (throw . AppError . T.pack . show)- & trap @IOException (throw . AppError . T.pack . show)- & trap @JsonDecodeError (throw . AppError . T.pack . show)- & trap @RdsDataError (throw . AppError . T.pack . show)- & trap @YamlDecodeError (throw . AppError . T.pack . show)+ & trap @AWS.Error (throw . AppError . tshow)+ & trap @IOException (throw . AppError . tshow)+ & trap @JsonDecodeError (throw . AppError . tshow)+ & trap @RdsDataError (throw . AppError . tshow)+ & trap @YamlDecodeError (throw . AppError . tshow)
− app/App/Show.hs
@@ -1,10 +0,0 @@-module App.Show- ( tshow,- ) where--import Data.Text (Text)--import qualified Data.Text as T--tshow :: Show a => a -> Text-tshow = T.pack . show
rds-data.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.6 name: rds-data-version: 0.1.1.2+version: 0.1.1.3 synopsis: Codecs for use with AWS rds-data description: Codecs for use with AWS rds-data. category: Data@@ -106,6 +106,7 @@ , bytestring , contravariant , generic-lens+ , hw-prelude , microlens , mtl , text@@ -130,6 +131,7 @@ Data.RdsData.Internal.Aeson Data.RdsData.Internal.Convert Data.RdsData.Internal.Maybe+ Data.RdsData.Internal.Show Data.RdsData.Migration Data.RdsData.Migration.Types Data.RdsData.Orphans@@ -254,7 +256,6 @@ App.Config App.Console App.Options- App.Show hs-source-dirs: app ghc-options: -threaded "-with-rtsopts=-I0 -A16m -N2 --disable-delayed-os-memory-return"
src/Data/RdsData/Decode/Row.hs view
@@ -46,6 +46,7 @@ import Data.Functor.Identity (Identity) import Data.Int import Data.RdsData.Decode.Value (DecodeValue)+import Data.RdsData.Internal.Show import Data.RdsData.Types.Value import Data.Text import Data.Time@@ -192,7 +193,7 @@ t <- text case parseTimeM True defaultTimeLocale "%H:%M:%S%Q" (T.unpack t) of Just a -> pure a- Nothing -> throwError $ "Failed to parse TimeOfDay: " <> T.pack (show t)+ Nothing -> throwError $ "Failed to parse TimeOfDay: " <> tshow t ulid :: DecodeRow ULID ulid = do@@ -206,21 +207,21 @@ t <- text case parseTimeM True defaultTimeLocale "%Y-%m-%d %H:%M:%S" (T.unpack t) of Just a -> pure a- Nothing -> throwError $ "Failed to parse UTCTime: " <> T.pack (show t)+ Nothing -> throwError $ "Failed to parse UTCTime: " <> tshow t uuid :: DecodeRow UUID uuid = do t <- text case UUID.fromString (T.unpack t) of Just a -> pure a- Nothing -> throwError $ "Failed to parse UUID: " <> T.pack (show t)+ Nothing -> throwError $ "Failed to parse UUID: " <> tshow t day :: DecodeRow Day day = do t <- text case parseTimeM True defaultTimeLocale "%Y-%m-%d" (T.unpack t) of Just a -> pure a- Nothing -> throwError $ "Failed to parse Day: " <> T.pack (show t)+ Nothing -> throwError $ "Failed to parse Day: " <> tshow t ignore :: DecodeRow () ignore =
src/Data/RdsData/Decode/Value.hs view
@@ -51,6 +51,7 @@ import Data.Int import Data.RdsData.Decode.Array (DecodeArray (..)) import Data.RdsData.Internal.Aeson+import Data.RdsData.Internal.Show import Data.RdsData.Types.Value import Data.Text (Text) import Data.Time@@ -288,8 +289,8 @@ timeOfDay = do t <- text case parseTimeM True defaultTimeLocale "%H:%M:%S%Q" (T.unpack t) of- Just a -> pure a- Nothing -> decodeValueFailed "timeOfDay" "TimeOfDay" (Just (T.pack (show t)))+ Just a -> pure a+ Nothing -> decodeValueFailed "timeOfDay" "TimeOfDay" (Just (tshow t)) utcTime :: DecodeValue UTCTime utcTime = do
+ src/Data/RdsData/Internal/Show.hs view
@@ -0,0 +1,5 @@+module Data.RdsData.Internal.Show+ ( tshow+ ) where++import HaskellWorks.Prelude
src/Data/RdsData/Orphans.hs view
@@ -21,4 +21,3 @@ instance ToJSON ULID where toJSON = J.toJSON . show-