Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New fail function #23

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions polysemy/Data/RdsData/Polysemy/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ initialiseDb = withFrozenCallStack do
, " deployed_by TEXT NOT NULL,"
, " CONSTRAINT valid_ulid_constraint"
, " CHECK (ulid::text ~ '^[0-9A-HJKMNP-TV-Z]{26}$')"
, ");"
, ")"
]

executeStatement_
"CREATE INDEX IF NOT EXISTS idx_migration_created_at ON migration (created_at);"
"CREATE INDEX IF NOT EXISTS idx_migration_created_at ON migration (created_at)"

executeStatement_
"CREATE INDEX IF NOT EXISTS idx_migration_deployed_by ON migration (deployed_by);"
"CREATE INDEX IF NOT EXISTS idx_migration_deployed_by ON migration (deployed_by)"
8 changes: 7 additions & 1 deletion src/Data/RdsData/Decode/Value.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ module Data.RdsData.Decode.Value
, uuid
, day

, fail

) where

import Amazonka.Data.Base64
Expand All @@ -54,7 +56,7 @@ import Data.Text (Text)
import Data.Time
import Data.UUID (UUID)
import Data.Word
import Prelude hiding (maybe, null)
import Prelude hiding (fail, maybe, null)

import qualified Amazonka.Data.ByteString as AWS
import qualified Data.Aeson as J
Expand Down Expand Up @@ -87,6 +89,10 @@ instance Monad DecodeValue where
a' <- a v
decodeValue (f a') v

fail :: Text -> DecodeValue a
fail =
DecodeValue . const . Left

--------------------------------------------------------------------------------

rdsValue :: DecodeValue Value
Expand Down
Loading