| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Hpgsql.Types
Synopsis
- newtype Only a = Only {
- fromOnly :: a
- newtype Aeson a = Aeson {
- getAeson :: a
- data PgJson
- newtype PGArray a = PGArray {
- fromPGArray :: [a]
- data h :. t = !h :. !t
- pgJsonByteString :: PgJson -> ByteString
Documentation
The 1-tuple type or single-value "collection".
This type is structurally equivalent to the
Identity type, but its intent is more
about serving as the anonymous 1-tuple type missing from Haskell for attaching
typeclass instances.
Parameter usage example:
encodeSomething (Only (42::Int))Result usage example:
xs <- decodeSomething
forM_ xs $ \(Only id) -> {- ... -}Instances
| Functor Only | |||||
| NFData a => NFData (Only a) | |||||
Defined in Data.Tuple.Only | |||||
| Data a => Data (Only a) | |||||
Defined in Data.Tuple.Only Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Only a -> c (Only a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Only a) # toConstr :: Only a -> Constr # dataTypeOf :: Only a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Only a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Only a)) # gmapT :: (forall b. Data b => b -> b) -> Only a -> Only a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Only a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Only a -> r # gmapQ :: (forall d. Data d => d -> u) -> Only a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Only a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Only a -> m (Only a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Only a -> m (Only a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Only a -> m (Only a) # | |||||
| Generic (Only a) | |||||
Defined in Data.Tuple.Only Associated Types
| |||||
| Read a => Read (Only a) | |||||
| Show a => Show (Only a) | |||||
| Eq a => Eq (Only a) | |||||
| Ord a => Ord (Only a) | |||||
| FromPgField a => FromPgRow (Only a) Source # | |||||
Defined in Hpgsql.Encoding Methods rowDecoder :: RowDecoder (Only a) Source # | |||||
| ToPgField a => ToPgRow (Only a) Source # | |||||
Defined in Hpgsql.Encoding Methods rowEncoder :: RowEncoder (Only a) Source # | |||||
| type Rep (Only a) | |||||
Defined in Data.Tuple.Only | |||||
A newtype wrapper to decode a JSON value with Aeson into your type (from either json or jsonb), and to encode to jsonb.
Instances
| Functor Aeson Source # | |
| Read a => Read (Aeson a) Source # | |
| Show a => Show (Aeson a) Source # | |
| Eq a => Eq (Aeson a) Source # | |
| FromJSON a => FromPgField (Aeson a) Source # | |
Defined in Hpgsql.Types Methods fieldDecoder :: FieldDecoder (Aeson a) Source # | |
| ToJSON a => ToPgField (Aeson a) Source # | |
Defined in Hpgsql.Types Methods fieldEncoder :: FieldEncoder (Aeson a) Source # | |
A JSON type that does not incur the costs of deserializing
in its FromPgField instance because it assumes postgres only generates
valid JSON. Useful for extra performance if its opaqueness is not a problem.
Although it does have a toJSON method, using it will incur a
deserialization cost, so if you find yourself using that too much consider just using
Value or the Aeson newtype instead of this.
Instances
| ToJSON PgJson Source # | |
| FromPgField PgJson Source # | |
Defined in Hpgsql.Types Methods | |
Encodes a Haskell list as a postgres array. You can also use Vector if you prefer.
The reason for this type instead of allowing [a] to be a field is that an instance
for [a] would require an overlappable instance for String, and that is not ideal.
Constructors
| PGArray | |
Fields
| |
Instances
| Functor PGArray Source # | |
| Read a => Read (PGArray a) Source # | |
| Show a => Show (PGArray a) Source # | |
| Eq a => Eq (PGArray a) Source # | |
| Ord a => Ord (PGArray a) Source # | |
| FromPgField a => FromPgField (PGArray a) Source # | |
Defined in Hpgsql.Types Methods fieldDecoder :: FieldDecoder (PGArray a) Source # | |
| ToPgField a => ToPgField (PGArray a) Source # | |
Defined in Hpgsql.Types Methods fieldEncoder :: FieldEncoder (PGArray a) Source # | |
A way to compose two rows.
Constructors
| !h :. !t infixr 3 |
Instances
| (Read h, Read t) => Read (h :. t) Source # | |
| (Show h, Show t) => Show (h :. t) Source # | |
| (Eq h, Eq t) => Eq (h :. t) Source # | |
| (Ord h, Ord t) => Ord (h :. t) Source # | |
Defined in Hpgsql.Types | |
| (FromPgRow a, FromPgRow b) => FromPgRow (a :. b) Source # | |
Defined in Hpgsql.Types Methods rowDecoder :: RowDecoder (a :. b) Source # | |
| (ToPgRow a, ToPgRow b) => ToPgRow (a :. b) Source # | |
Defined in Hpgsql.Types Methods rowEncoder :: RowEncoder (a :. b) Source # | |
pgJsonByteString :: PgJson -> ByteString Source #
A valid UTF8 representation of the JSON value.