Skip to content

Commit 35ea86b

Browse files
committed
Move to released algebra
1 parent efe5b10 commit 35ea86b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+80
-51
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
uses: nikita-volkov/haskell-hackage-lib-github-actions-workflows/.github/workflows/check-cabal.yaml@v4
2020
secrets: inherit
2121

22-
build-with-ghc-9-2:
22+
build-with-oldest:
2323
uses: nikita-volkov/haskell-hackage-lib-github-actions-workflows/.github/workflows/build.yaml@v4
2424
secrets: inherit
2525
with:
26-
ghc: "9.2"
26+
ghc: "8.10"
2727
skip-doctest: true
2828
skip-benchmarks: true
2929
test-options: >

cabal.project

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,3 @@ allow-newer:
44
*:base,
55
*:ghc,
66
*:template-haskell,
7-
8-
source-repository-package
9-
type: git
10-
location: https://github.com/nikita-volkov/postgresql-types-algebra
11-
tag: c37ff6c7b43bb9e89e58c308b5023305b931577c

postgresql-types.cabal

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ common base
6363
MultiParamTypeClasses
6464
MultiWayIf
6565
NamedFieldPuns
66-
NoFieldSelectors
6766
NoImplicitPrelude
6867
NoMonomorphismRestriction
6968
NumericUnderscores
70-
OverloadedRecordDot
7169
OverloadedStrings
7270
ParallelListComp
7371
PatternGuards
@@ -167,7 +165,7 @@ library
167165
postgresql-types:base-extras,
168166
postgresql-types:jsonifier-aeson,
169167
postgresql-types:time-extras,
170-
postgresql-types-algebra,
168+
postgresql-types-algebra ^>=0.1,
171169
profunctors ^>=5.6 && <6,
172170
ptr-peeker ^>=0.1,
173171
ptr-poker ^>=0.1.3,

src/integration-tests/Main/Scripts.hs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@ mappingSpec _ =
3838
(Just baseOid, Just arrayOid) ->
3939
pure (baseOid, arrayOid)
4040
_ -> do
41-
result <- Procedures.run connection Procedures.GetTypeInfoByNameParams {name = typeName}
42-
let baseOid = case maybeBaseOid of
43-
Just oid -> oid
44-
Nothing -> fromMaybe (error $ "Base OID not found for type: " <> Text.unpack typeName) result.baseOid
45-
arrayOid = case maybeArrayOid of
46-
Just oid -> oid
47-
Nothing -> fromMaybe (error $ "Array OID not found for type: " <> Text.unpack typeName) result.arrayOid
41+
Procedures.GetTypeInfoByNameResult {..} <- Procedures.run connection Procedures.GetTypeInfoByNameParams {name = typeName}
42+
baseOid <- case maybeBaseOid of
43+
Just oid -> pure oid
44+
Nothing -> case baseOid of
45+
Just oid -> pure oid
46+
Nothing -> fail $ "Base OID not found for type: " <> Text.unpack typeName
47+
arrayOid <- case maybeArrayOid of
48+
Just oid -> pure oid
49+
Nothing -> case arrayOid of
50+
Just oid -> pure oid
51+
Nothing -> fail $ "Array OID not found for type: " <> Text.unpack typeName
4852
pure (baseOid, arrayOid)
4953
in describe "IsScalar" do
5054
describe (Text.unpack typeName) do
@@ -206,12 +210,12 @@ mappingSpec _ =
206210

207211
describe "Metadata" do
208212
it "Should match the DB catalogue" \(connection :: Pq.Connection) -> do
209-
result <- Procedures.run connection Procedures.GetTypeInfoByNameParams {name = typeName}
213+
Procedures.GetTypeInfoByNameResult {..} <- Procedures.run connection Procedures.GetTypeInfoByNameParams {name = typeName}
210214
case (maybeBaseOid, maybeArrayOid) of
211215
(Just expectedBaseOid, Just expectedArrayOid) -> do
212-
shouldBe (Just expectedBaseOid) result.baseOid
213-
shouldBe (Just expectedArrayOid) result.arrayOid
216+
shouldBe baseOid (Just expectedBaseOid)
217+
shouldBe arrayOid (Just expectedArrayOid)
214218
_ -> do
215219
-- For types without stable OIDs, just verify the OIDs exist
216-
shouldSatisfy result.baseOid isJust
217-
shouldSatisfy result.arrayOid isJust
220+
shouldSatisfy baseOid isJust
221+
shouldSatisfy arrayOid isJust

src/library/PostgresqlTypes/Bit.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ instance (TypeLits.KnownNat numBits) => Arbitrary (Bit numBits) where
4949
Just bit -> pure bit
5050

5151
instance (TypeLits.KnownNat numBits) => IsScalar (Bit numBits) where
52+
schemaName = Tagged Nothing
5253
typeName = Tagged "bit"
5354
baseOid = Tagged (Just 1560)
5455
arrayOid = Tagged (Just 1561)

src/library/PostgresqlTypes/Bool.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ newtype Bool = Bool Data.Bool.Bool
2525
deriving (Show, Read, IsString) via (ViaIsScalar Bool)
2626

2727
instance IsScalar Bool where
28+
schemaName = Tagged Nothing
2829
typeName = Tagged "bool"
2930
baseOid = Tagged (Just 16)
3031
arrayOid = Tagged (Just 1000)

src/library/PostgresqlTypes/Box.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ instance Arbitrary Box where
5656
]
5757

5858
instance IsScalar Box where
59+
schemaName = Tagged Nothing
5960
typeName = Tagged "box"
6061
baseOid = Tagged (Just 603)
6162
arrayOid = Tagged (Just 1020)

src/library/PostgresqlTypes/Bpchar.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ instance (TypeLits.KnownNat numChars) => Arbitrary (Bpchar numChars) where
5656
Just char -> pure char
5757

5858
instance (TypeLits.KnownNat numChars) => IsScalar (Bpchar numChars) where
59+
schemaName = Tagged Nothing
5960
typeName = Tagged "bpchar"
6061
baseOid = Tagged (Just 1042)
6162
arrayOid = Tagged (Just 1014)

src/library/PostgresqlTypes/Bytea.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ newtype Bytea = Bytea ByteString
2727
deriving (Show, Read, IsString) via (ViaIsScalar Bytea)
2828

2929
instance IsScalar Bytea where
30+
schemaName = Tagged Nothing
3031
typeName = Tagged "bytea"
3132
baseOid = Tagged (Just 17)
3233
arrayOid = Tagged (Just 1001)

src/library/PostgresqlTypes/Char.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ instance Arbitrary Char where
4949
Char <$> QuickCheck.choose (0, 127)
5050

5151
instance IsScalar Char where
52+
schemaName = Tagged Nothing
5253
typeName = Tagged "char"
5354
baseOid = Tagged (Just 18)
5455
arrayOid = Tagged (Just 1002)

0 commit comments

Comments
 (0)