packages feed

hasql-interpolate 0.2.2.0 → 1.0.0.0

raw patch · 6 files changed

+46/−29 lines, 6 filesdep +iproutedep ~basedep ~hasqldep ~template-haskell

Dependencies added: iproute

Dependency ranges changed: base, hasql, template-haskell

Files

CHANGELOG.md view
@@ -1,29 +1,35 @@-## 0.2.2.0 -- 2024-05-07+## [1.0.0.0] - July 10, 2024 +* Add IP address type encoders and decoders+* Increase tuple instances to size 16+* Support `hasql-1.8`++## [0.2.2.0] - May 7, 2024+ * Make compile-time syntax error messages prettier * Add `EncodeValue` instances for `ByteString` and `LazyByteString` * Add `JsonBytes` and `JsonbBytes` newtypes -## 0.2.1.0 -- 2023-08-29+## [0.2.1.0] - August 29, 2023  * Fix encoder generation bug (https://github.com/awkward-squad/hasql-interpolate/pull/10) -## 0.2.0.0 -- 2023-08-17+## [0.2.0.0] - August 17, 2023  * Relax context of tuple instances for `EncodeRow` from `EncodeValue` to `EncodeField` (https://github.com/awkward-squad/hasql-interpolate/pull/9) -## 0.1.0.4 -- 2023-01-10+## [0.1.0.4] - January 10, 2023  * Support `mtl-2.3` -## 0.1.0.3 -- 2022-07-31+## [0.1.0.3] - July 31, 2022  * Support GHC 9.2 -## 0.1.0.2 -- 2022-02-04+## [0.1.0.2] - February 4, 2022  * Support `hasql-1.5` -## 0.1.0.1 -- 2021-11-15+## [0.1.0.1] - November 15, 2021  * Fixed bug in multiline parser
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2021 Travis Staton+Copyright 2021-2024 Travis Staton, Mitchell Dalvi Rosen  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 
hasql-interpolate.cabal view
@@ -1,16 +1,16 @@ cabal-version:      2.4 name:               hasql-interpolate-version:            0.2.2.0+version:            1.0.0.0  author: Travis Staton <hello@travisstaton.com> category: Hasql, Database, PostgreSQL-copyright: 2021, Travis Staton+copyright: Copyright (C) 2021-2024 Travis Staton, Mitchell Dalvi Rosen extra-source-files: CHANGELOG.md homepage: https://github.com/awkward-squad/hasql-interpolate license-file: LICENSE license: BSD-3-Clause tested-with: GHC == 9.2.8, GHC == 9.4.5-maintainer: Travis Staton <hello@travisstaton.com>, Mitchell Rosen+maintainer: Travis Staton <hello@travisstaton.com>, Mitchell Dalvi Rosen <mitchellwrosen@gmail.com> synopsis: QuasiQuoter that supports expression interpolation for hasql description: @@ -37,15 +37,16 @@      build-depends:    aeson ^>= 1.5 || ^>= 2.0 || ^>= 2.1 || ^>= 2.2,                       array ^>= 0.5,-                      base ^>= 4.14 || ^>= 4.15 || ^>= 4.16 || ^>= 4.17 || ^>= 4.18 || ^>= 4.19,+                      base ^>= 4.14 || ^>= 4.15 || ^>= 4.16 || ^>= 4.17 || ^>= 4.18 || ^>= 4.19 || ^>= 4.20,                       bytestring ^>= 0.10 || ^>= 0.11 || ^>= 0.12,                       containers ^>= 0.5 || ^>= 0.6 || ^>= 0.7,                       haskell-src-meta ^>= 0.8,-                      hasql ^>= 1.4 || ^>= 1.5 || ^>= 1.6 || ^>= 1.7,+                      hasql ^>= 1.8,+                      iproute ^>= 1.7,                       megaparsec ^>= 8.0.0 || ^>= 9.0 || ^>= 9.1 || ^>= 9.2 || ^>= 9.3 || ^>= 9.4 || ^>= 9.5 || ^>= 9.6,                       mtl ^>= 2.1 || ^>= 2.2 || ^>= 2.3,                       scientific ^>= 0.3,-                      template-haskell ^>= 2.14 || ^>= 2.15 || ^>= 2.16 || ^>= 2.17 || ^>= 2.18 || ^>= 2.19 || ^>= 2.20 || ^>= 2.21,+                      template-haskell ^>= 2.14 || ^>= 2.15 || ^>= 2.16 || ^>= 2.17 || ^>= 2.18 || ^>= 2.19 || ^>= 2.20 || ^>= 2.21 || ^>= 2.22,                       text ^>= 1.2.4 || ^>= 2.0 || ^>= 2.1,                       time ^>= 1.9.3 || ^>= 1.10 || ^>= 1.11 || ^>= 1.12 || ^>= 1.14,                       transformers ^>= 0.5 || ^>= 0.6,
lib/Hasql/Interpolate/Internal/Decoder.hs view
@@ -20,6 +20,7 @@   ) where +import Data.IP (IPRange) import Data.Int import Data.Scientific (Scientific) import Data.Text (Text)@@ -91,21 +92,21 @@ class DecodeResult a where   decodeResult :: Result a -instance GDecodeRow a => GDecodeRow (M1 t i a) where+instance (GDecodeRow a) => GDecodeRow (M1 t i a) where   gdecodeRow = M1 <$> gdecodeRow  instance (GDecodeRow a, GDecodeRow b) => GDecodeRow (a :*: b) where   gdecodeRow = (:*:) <$> gdecodeRow <*> gdecodeRow -instance DecodeField a => GDecodeRow (K1 i a) where+instance (DecodeField a) => GDecodeRow (K1 i a) where   gdecodeRow = K1 <$> column decodeField  -- | Parse a postgres @array@ using 'listArray'-instance DecodeField a => DecodeValue [a] where+instance (DecodeField a) => DecodeValue [a] where   decodeValue = listArray decodeField  -- | Parse a postgres @array@ using 'vectorArray'-instance DecodeField a => DecodeValue (Vector a) where+instance (DecodeField a) => DecodeValue (Vector a) where   decodeValue = vectorArray decodeField  -- | Parse a postgres @bool@ using 'bool'@@ -164,28 +165,32 @@ instance DecodeValue UUID where   decodeValue = uuid +-- | Parse a postgres @inet@ using 'inet'+instance DecodeValue IPRange where+  decodeValue = inet+ -- | Overlappable instance for parsing non-nullable values-instance {-# OVERLAPPABLE #-} DecodeValue a => DecodeField a where+instance {-# OVERLAPPABLE #-} (DecodeValue a) => DecodeField a where   decodeField = nonNullable decodeValue  -- | Instance for parsing nullable values-instance DecodeValue a => DecodeField (Maybe a) where+instance (DecodeValue a) => DecodeField (Maybe a) where   decodeField = nullable decodeValue  -- | Parse any number of rows into a list ('rowList')-instance DecodeRow a => DecodeResult [a] where+instance (DecodeRow a) => DecodeResult [a] where   decodeResult = rowList decodeRow  -- | Parse any number of rows into a 'Vector' ('rowVector')-instance DecodeRow a => DecodeResult (Vector a) where+instance (DecodeRow a) => DecodeResult (Vector a) where   decodeResult = rowVector decodeRow  -- | Parse zero or one rows, throw 'Hasql.Errors.UnexpectedAmountOfRows' otherwise. ('rowMaybe')-instance DecodeRow a => DecodeResult (Maybe a) where+instance (DecodeRow a) => DecodeResult (Maybe a) where   decodeResult = rowMaybe decodeRow  -- | Ignore the query response ('noResult') instance DecodeResult () where   decodeResult = noResult -$(traverse genDecodeRowInstance [2 .. 8])+$(traverse genDecodeRowInstance [2 .. 16])
lib/Hasql/Interpolate/Internal/EncodeRow.hs view
@@ -149,4 +149,4 @@     k (\(K1 a) b -> a : b) [] (E.param (E.nonNullable (E.foldableArray encodeField))) 1   {-# INLINE gUnzipWithEncoder #-} -$(traverse genEncodeRowInstance [2 .. 8])+$(traverse genEncodeRowInstance [2 .. 16])
lib/Hasql/Interpolate/Internal/Encoder.hs view
@@ -14,6 +14,7 @@ import Data.ByteString.Lazy (LazyByteString) import Data.ByteString.Lazy qualified as ByteString.Lazy import Data.Functor.Contravariant (contramap)+import Data.IP (IPRange) import Data.Int import Data.Scientific (Scientific) import Data.Text (Text)@@ -40,11 +41,11 @@   encodeValue :: Value a  -- | Encode a list as a postgres array using 'foldableArray'-instance EncodeField a => EncodeValue [a] where+instance (EncodeField a) => EncodeValue [a] where   encodeValue = foldableArray encodeField  -- | Encode a 'Vector' as a postgres array using 'foldableArray'-instance EncodeField a => EncodeValue (Vector a) where+instance (EncodeField a) => EncodeValue (Vector a) where   encodeValue = foldableArray encodeField  -- | Encode a 'Bool' as a postgres @boolean@ using 'bool'@@ -103,6 +104,10 @@ instance EncodeValue UUID where   encodeValue = uuid +-- | Encode an 'IPRange' as a postgres @inet@ using 'inet'+instance EncodeValue IPRange where+  encodeValue = inet+ -- | Encode a 'ByteString' as a postgres @bytea@ using 'bytea' instance EncodeValue ByteString where   encodeValue = bytea@@ -118,9 +123,9 @@   encodeField :: NullableOrNot Value a  -- | Overlappable instance for all non-nullable types.-instance {-# OVERLAPPABLE #-} EncodeValue a => EncodeField a where+instance {-# OVERLAPPABLE #-} (EncodeValue a) => EncodeField a where   encodeField = nonNullable encodeValue  -- | Instance for all nullable types. 'Nothing' is encoded as @null@.-instance EncodeValue a => EncodeField (Maybe a) where+instance (EncodeValue a) => EncodeField (Maybe a) where   encodeField = nullable encodeValue