forked from nikita-volkov/postgresql-types
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostgresql-types.cabal
More file actions
309 lines (286 loc) · 8.62 KB
/
postgresql-types.cabal
File metadata and controls
309 lines (286 loc) · 8.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
cabal-version: 3.0
name: postgresql-types
version: 0.1.1.1
category: PostgreSQL, Codecs
synopsis: Precise PostgreSQL types representation and driver-agnostic codecs
description:
This package provides a Haskell representation of PostgreSQL data types, with mappings to and from both binary and textual formats of the PostgreSQL wire protocol. The types are implemented in their canonical forms, directly corresponding to their PostgreSQL counterparts. The philosophy is that nuance matters, so all special values are represented without data loss or compromise.
The types presented by this package do not necessarily have direct mappings to common Haskell types. Canonicalizing conversions and smart constructors are provided to address this.
For example, any @text@ value from PostgreSQL produces a valid 'Data.Text.Text' value in Haskell, but not every Haskell 'Data.Text.Text' value produces a valid PostgreSQL @text@, because PostgreSQL does not allow NUL bytes in text fields, whereas Haskell's 'Data.Text.Text' does. In the case of dates, the supported date ranges may differ between PostgreSQL and Haskell's "time" library. Therefore, conversions between these types and common Haskell types may be partial and may fail if the data cannot be represented in the target type.
All types supply 'Test.QuickCheck.Arbitrary' instances that cover the full range of valid PostgreSQL values. Every type is property-tested to validate round-trip conversions between binary and textual formats against PostgreSQL versions 9 to 18.
The library can be used as the basis for various PostgreSQL libraries. Ecosystem integration adapters are available for:
* hasql: <https://hackage.haskell.org/package/hasql-postgresql-types>
* postgresql-simple: <https://hackage.haskell.org/package/postgresql-simple-postgresql-types>
homepage: https://github.com/nikita-volkov/postgresql-types
bug-reports: https://github.com/nikita-volkov/postgresql-types/issues
author: Nikita Volkov <[email protected]>
maintainer: Nikita Volkov <[email protected]>
copyright: (c) 2025, Nikita Volkov
license: MIT
license-file: LICENSE
extra-doc-files:
LICENSE
README.md
source-repository head
type: git
location: https://github.com/nikita-volkov/postgresql-types
common base
default-language: Haskell2010
default-extensions:
ApplicativeDo
BangPatterns
BinaryLiterals
BlockArguments
ConstraintKinds
DataKinds
DefaultSignatures
DeriveDataTypeable
DeriveFoldable
DeriveFunctor
DeriveTraversable
DerivingStrategies
DerivingVia
DuplicateRecordFields
EmptyDataDecls
FlexibleContexts
FlexibleInstances
FunctionalDependencies
GADTs
GeneralizedNewtypeDeriving
LambdaCase
LiberalTypeSynonyms
MagicHash
MultiParamTypeClasses
MultiWayIf
NamedFieldPuns
NoImplicitPrelude
NoMonomorphismRestriction
NumericUnderscores
OverloadedStrings
ParallelListComp
PatternGuards
QuasiQuotes
RankNTypes
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
StrictData
TemplateHaskell
TupleSections
TypeApplications
TypeFamilies
TypeOperators
UnboxedTuples
ViewPatterns
common executable
import: base
ghc-options:
-O2
-threaded
-with-rtsopts=-N
-rtsopts
-funbox-strict-fields
common test
import: base
ghc-options:
-threaded
-with-rtsopts=-N
library
import: base
hs-source-dirs: src/library
exposed-modules:
PostgresqlTypes
PostgresqlTypes.Bit
PostgresqlTypes.Bool
PostgresqlTypes.Box
PostgresqlTypes.Bpchar
PostgresqlTypes.Bytea
PostgresqlTypes.Char
PostgresqlTypes.Cidr
PostgresqlTypes.Circle
PostgresqlTypes.Date
PostgresqlTypes.Float4
PostgresqlTypes.Float8
PostgresqlTypes.Hstore
PostgresqlTypes.Inet
PostgresqlTypes.Int2
PostgresqlTypes.Int4
PostgresqlTypes.Int8
PostgresqlTypes.Interval
PostgresqlTypes.Json
PostgresqlTypes.Jsonb
PostgresqlTypes.Line
PostgresqlTypes.Lseg
PostgresqlTypes.Macaddr
PostgresqlTypes.Macaddr8
PostgresqlTypes.Money
PostgresqlTypes.Multirange
PostgresqlTypes.Numeric
PostgresqlTypes.Oid
PostgresqlTypes.Path
PostgresqlTypes.Point
PostgresqlTypes.Polygon
PostgresqlTypes.Range
PostgresqlTypes.Text
PostgresqlTypes.Time
PostgresqlTypes.Timestamp
PostgresqlTypes.Timestamptz
PostgresqlTypes.Timetz
PostgresqlTypes.Uuid
PostgresqlTypes.Varbit
PostgresqlTypes.Varchar
other-modules:
PostgresqlTypes.Multirange.List
PostgresqlTypes.Multirange.QuickCheckGen
PostgresqlTypes.Numeric.Integer
PostgresqlTypes.Numeric.Scientific
PostgresqlTypes.Prelude
PostgresqlTypes.Timetz.Offset
PostgresqlTypes.Timetz.Time
PostgresqlTypes.Via
PostgresqlTypes.Via.IsScalar
build-depends:
QuickCheck >=2.14 && <3,
aeson >=2.2 && <3,
attoparsec >=0.14 && <0.19,
base >=4.11 && <5,
bytestring >=0.10 && <0.13,
containers >=0.6 && <0.9,
hashable >=1.3 && <2,
jsonifier ^>=0.2.1.3,
mtl >=2.2 && <3,
postgresql-types:jsonifier-aeson,
postgresql-types:time-extras,
postgresql-types-algebra ^>=0.1,
ptr-peeker ^>=0.1,
ptr-poker ^>=0.1.3,
scientific >=0.3 && <1,
tagged ^>=0.8.9,
text >=1.2 && <3,
text-builder ^>=1.0.0.4,
time >=1.12 && <2,
transformers >=0.5 && <0.7,
uuid >=1.3 && <2,
vector ^>=0.13,
library jsonifier-aeson
import: base
hs-source-dirs: src/jsonifier-aeson
exposed-modules:
JsonifierAeson
other-modules:
build-depends:
aeson >=2.2 && <3,
base >=4.11 && <5,
jsonifier ^>=0.2.1.3,
library time-extras
import: base
hs-source-dirs: src/time-extras
exposed-modules:
TimeExtras.TimeOfDay
TimeExtras.TimeZone
other-modules:
build-depends:
base >=4.11 && <5,
time >=1.12 && <2,
test-suite unit-tests
import: test
type: exitcode-stdio-1.0
hs-source-dirs: src/unit-tests
main-is: Main.hs
other-modules:
PostgresqlTypes.BitSpec
PostgresqlTypes.BoolSpec
PostgresqlTypes.BoxSpec
PostgresqlTypes.BpcharSpec
PostgresqlTypes.ByteaSpec
PostgresqlTypes.CharSpec
PostgresqlTypes.CidrSpec
PostgresqlTypes.CircleSpec
PostgresqlTypes.DateSpec
PostgresqlTypes.Float4Spec
PostgresqlTypes.Float8Spec
PostgresqlTypes.HstoreSpec
PostgresqlTypes.InetSpec
PostgresqlTypes.Int2Spec
PostgresqlTypes.Int4Spec
PostgresqlTypes.Int8Spec
PostgresqlTypes.IntervalSpec
PostgresqlTypes.JsonSpec
PostgresqlTypes.JsonbSpec
PostgresqlTypes.LineSpec
PostgresqlTypes.LsegSpec
PostgresqlTypes.Macaddr8Spec
PostgresqlTypes.MacaddrSpec
PostgresqlTypes.MoneySpec
PostgresqlTypes.MultirangeSpec
PostgresqlTypes.NumericSpec
PostgresqlTypes.OidSpec
PostgresqlTypes.PathSpec
PostgresqlTypes.PointSpec
PostgresqlTypes.PolygonSpec
PostgresqlTypes.RangeSpec
PostgresqlTypes.TextSpec
PostgresqlTypes.TimeSpec
PostgresqlTypes.TimestampSpec
PostgresqlTypes.TimestamptzSpec
PostgresqlTypes.TimetzSpec
PostgresqlTypes.UuidSpec
PostgresqlTypes.VarbitSpec
PostgresqlTypes.VarcharSpec
SpecHook
UnitTests.Scripts
build-tool-depends:
hspec-discover:hspec-discover >=2 && <3
build-depends:
QuickCheck >=2.14 && <3,
aeson >=2.2 && <3,
attoparsec >=0.14 && <0.15,
base >=4.11 && <5,
bytestring >=0.10 && <0.13,
containers >=0.6 && <0.9,
hspec >=2.11 && <3,
postgresql-types,
postgresql-types-algebra ^>=0.1,
ptr-peeker ^>=0.1,
ptr-poker ^>=0.1.2.16,
quickcheck-classes ^>=0.6.5,
quickcheck-instances ^>=0.3.33,
scientific >=0.3 && <1,
tagged ^>=0.8.9,
text >=1.2 && <3,
text-builder ^>=1.0.0.4,
time >=1.12 && <2,
uuid >=1.3 && <2,
vector ^>=0.13,
test-suite integration-tests
import: test
type: exitcode-stdio-1.0
hs-source-dirs: src/integration-tests
main-is: Main.hs
other-modules:
IntegrationTests.Scopes
IntegrationTests.Scripts
PqProcedures
PqProcedures.Algebra
PqProcedures.Procedures
PqProcedures.Procedures.GetTypeInfoByName
PqProcedures.Procedures.RunRoundtripQuery
PqProcedures.Procedures.RunStatement
build-depends:
QuickCheck >=2.14 && <3,
async >=2.2.6 && <2.3,
attoparsec >=0.14 && <0.15,
base >=4.11 && <5,
bytestring >=0.10 && <0.13,
hspec >=2.11 && <3,
postgresql-libpq >=0.10 && <0.12,
postgresql-types,
postgresql-types-algebra ^>=0.1,
ptr-peeker ^>=0.1,
ptr-poker ^>=0.1.2.16,
quickcheck-instances ^>=0.3.33,
stm >=2.5 && <3,
tagged ^>=0.8.9,
testcontainers-postgresql ^>=0.2.0.1,
text >=1.2 && <3,
text-builder ^>=1.0.0.4,