mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-12-26 20:12:09 +03:00
Support for inet
data type.
This commit is contained in:
parent
b258dfe13e
commit
85e4c7a686
@ -74,7 +74,7 @@ library
|
||||
-- parsing:
|
||||
attoparsec >= 0.10 && < 0.14,
|
||||
-- database:
|
||||
postgresql-binary >= 0.9.1.1 && < 0.10,
|
||||
postgresql-binary >= 0.9.1.1 && < 1,
|
||||
postgresql-libpq == 0.9.*,
|
||||
-- builders:
|
||||
bytestring-tree-builder >= 0.2.5 && < 0.3,
|
||||
@ -89,6 +89,7 @@ library
|
||||
text >= 1 && < 2,
|
||||
bytestring >= 0.10 && < 0.11,
|
||||
hashable >= 1.2 && < 1.3,
|
||||
network-ip >= 0.2 && < 1,
|
||||
-- control:
|
||||
semigroups >= 0.18 && < 0.20,
|
||||
data-default-class >= 0.0.1 && < 0.2,
|
||||
|
@ -37,6 +37,7 @@ module Hasql.Decoders
|
||||
timetz,
|
||||
interval,
|
||||
uuid,
|
||||
inet,
|
||||
json,
|
||||
jsonBytes,
|
||||
jsonb,
|
||||
@ -69,7 +70,7 @@ import qualified Hasql.Private.Decoders.Value as Value
|
||||
import qualified Hasql.Private.Decoders.Array as Array
|
||||
import qualified Hasql.Private.Decoders.Composite as Composite
|
||||
import qualified Hasql.Private.Prelude as Prelude
|
||||
|
||||
import qualified Network.IP.Addr as IPAddr
|
||||
|
||||
-- * Result
|
||||
-------------------------
|
||||
@ -415,6 +416,14 @@ uuid :: Value UUID
|
||||
uuid =
|
||||
Value (Value.decoder (const Decoder.uuid))
|
||||
|
||||
-- |
|
||||
-- Decoder of the @INET@ values.
|
||||
--
|
||||
{-# INLINABLE inet #-}
|
||||
inet :: Value (IPAddr.NetAddr IPAddr.IP)
|
||||
inet =
|
||||
Value (Value.decoder (const Decoder.inet))
|
||||
|
||||
-- |
|
||||
-- Decoder of the @JSON@ values into a JSON AST.
|
||||
--
|
||||
|
@ -26,6 +26,7 @@ module Hasql.Encoders
|
||||
timetz,
|
||||
interval,
|
||||
uuid,
|
||||
inet,
|
||||
json,
|
||||
jsonBytes,
|
||||
jsonb,
|
||||
@ -49,7 +50,7 @@ import qualified Hasql.Private.Encoders.Value as Value
|
||||
import qualified Hasql.Private.Encoders.Array as Array
|
||||
import qualified Hasql.Private.PTI as PTI
|
||||
import qualified Hasql.Private.Prelude as Prelude
|
||||
|
||||
import qualified Network.IP.Addr as IPAddr
|
||||
|
||||
-- * Parameters Product Encoder
|
||||
-------------------------
|
||||
@ -301,6 +302,13 @@ uuid :: Value UUID
|
||||
uuid =
|
||||
Value (Value.unsafePTI PTI.uuid (const Encoder.uuid))
|
||||
|
||||
-- |
|
||||
-- Encoder of @INET@ values.
|
||||
{-# INLINABLE inet #-}
|
||||
inet :: Value (IPAddr.NetAddr IPAddr.IP)
|
||||
inet =
|
||||
Value (Value.unsafePTI PTI.inet (const Encoder.inet))
|
||||
|
||||
-- |
|
||||
-- Encoder of @JSON@ values from JSON AST.
|
||||
{-# INLINABLE json #-}
|
||||
|
Loading…
Reference in New Issue
Block a user