hpgsql
Safe HaskellNone
LanguageHaskell2010

Hpgsql.Types

Synopsis

Documentation

newtype Only a #

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) -> {- ... -}

Constructors

Only 

Fields

Instances

Instances details
Functor Only 
Instance details

Defined in Data.Tuple.Only

Methods

fmap :: (a -> b) -> Only a -> Only b #

(<$) :: a -> Only b -> Only a #

NFData a => NFData (Only a) 
Instance details

Defined in Data.Tuple.Only

Methods

rnf :: Only a -> () #

Data a => Data (Only a) 
Instance details

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) 
Instance details

Defined in Data.Tuple.Only

Associated Types

type Rep (Only a) 
Instance details

Defined in Data.Tuple.Only

type Rep (Only a) = D1 ('MetaData "Only" "Data.Tuple.Only" "Only-0.1-FpJBkLoTnaaJXIU7wfAuYN" 'True) (C1 ('MetaCons "Only" 'PrefixI 'True) (S1 ('MetaSel ('Just "fromOnly") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

from :: Only a -> Rep (Only a) x #

to :: Rep (Only a) x -> Only a #

Read a => Read (Only a) 
Instance details

Defined in Data.Tuple.Only

Show a => Show (Only a) 
Instance details

Defined in Data.Tuple.Only

Methods

showsPrec :: Int -> Only a -> ShowS #

show :: Only a -> String #

showList :: [Only a] -> ShowS #

Eq a => Eq (Only a) 
Instance details

Defined in Data.Tuple.Only

Methods

(==) :: Only a -> Only a -> Bool #

(/=) :: Only a -> Only a -> Bool #

Ord a => Ord (Only a) 
Instance details

Defined in Data.Tuple.Only

Methods

compare :: Only a -> Only a -> Ordering #

(<) :: Only a -> Only a -> Bool #

(<=) :: Only a -> Only a -> Bool #

(>) :: Only a -> Only a -> Bool #

(>=) :: Only a -> Only a -> Bool #

max :: Only a -> Only a -> Only a #

min :: Only a -> Only a -> Only a #

FromPgField a => FromPgRow (Only a) Source # 
Instance details

Defined in Hpgsql.Encoding

ToPgField a => ToPgRow (Only a) Source # 
Instance details

Defined in Hpgsql.Encoding

type Rep (Only a) 
Instance details

Defined in Data.Tuple.Only

type Rep (Only a) = D1 ('MetaData "Only" "Data.Tuple.Only" "Only-0.1-FpJBkLoTnaaJXIU7wfAuYN" 'True) (C1 ('MetaCons "Only" 'PrefixI 'True) (S1 ('MetaSel ('Just "fromOnly") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

newtype Aeson a Source #

A newtype wrapper to decode a JSON value with Aeson into your type (from either json or jsonb), and to encode to jsonb.

Constructors

Aeson 

Fields

Instances

Instances details
Functor Aeson Source # 
Instance details

Defined in Hpgsql.Types

Methods

fmap :: (a -> b) -> Aeson a -> Aeson b #

(<$) :: a -> Aeson b -> Aeson a #

Read a => Read (Aeson a) Source # 
Instance details

Defined in Hpgsql.Types

Show a => Show (Aeson a) Source # 
Instance details

Defined in Hpgsql.Types

Methods

showsPrec :: Int -> Aeson a -> ShowS #

show :: Aeson a -> String #

showList :: [Aeson a] -> ShowS #

Eq a => Eq (Aeson a) Source # 
Instance details

Defined in Hpgsql.Types

Methods

(==) :: Aeson a -> Aeson a -> Bool #

(/=) :: Aeson a -> Aeson a -> Bool #

FromJSON a => FromPgField (Aeson a) Source # 
Instance details

Defined in Hpgsql.Types

ToJSON a => ToPgField (Aeson a) Source # 
Instance details

Defined in Hpgsql.Types

data PgJson 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

Instances details
ToJSON PgJson Source # 
Instance details

Defined in Hpgsql.Types

FromPgField PgJson Source # 
Instance details

Defined in Hpgsql.Types

newtype PGArray a Source #

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

Instances details
Functor PGArray Source # 
Instance details

Defined in Hpgsql.Types

Methods

fmap :: (a -> b) -> PGArray a -> PGArray b #

(<$) :: a -> PGArray b -> PGArray a #

Read a => Read (PGArray a) Source # 
Instance details

Defined in Hpgsql.Types

Show a => Show (PGArray a) Source # 
Instance details

Defined in Hpgsql.Types

Methods

showsPrec :: Int -> PGArray a -> ShowS #

show :: PGArray a -> String #

showList :: [PGArray a] -> ShowS #

Eq a => Eq (PGArray a) Source # 
Instance details

Defined in Hpgsql.Types

Methods

(==) :: PGArray a -> PGArray a -> Bool #

(/=) :: PGArray a -> PGArray a -> Bool #

Ord a => Ord (PGArray a) Source # 
Instance details

Defined in Hpgsql.Types

Methods

compare :: PGArray a -> PGArray a -> Ordering #

(<) :: PGArray a -> PGArray a -> Bool #

(<=) :: PGArray a -> PGArray a -> Bool #

(>) :: PGArray a -> PGArray a -> Bool #

(>=) :: PGArray a -> PGArray a -> Bool #

max :: PGArray a -> PGArray a -> PGArray a #

min :: PGArray a -> PGArray a -> PGArray a #

FromPgField a => FromPgField (PGArray a) Source # 
Instance details

Defined in Hpgsql.Types

ToPgField a => ToPgField (PGArray a) Source # 
Instance details

Defined in Hpgsql.Types

data h :. t infixr 3 Source #

A way to compose two rows.

Constructors

!h :. !t infixr 3 

Instances

Instances details
(Read h, Read t) => Read (h :. t) Source # 
Instance details

Defined in Hpgsql.Types

Methods

readsPrec :: Int -> ReadS (h :. t) #

readList :: ReadS [h :. t] #

readPrec :: ReadPrec (h :. t) #

readListPrec :: ReadPrec [h :. t] #

(Show h, Show t) => Show (h :. t) Source # 
Instance details

Defined in Hpgsql.Types

Methods

showsPrec :: Int -> (h :. t) -> ShowS #

show :: (h :. t) -> String #

showList :: [h :. t] -> ShowS #

(Eq h, Eq t) => Eq (h :. t) Source # 
Instance details

Defined in Hpgsql.Types

Methods

(==) :: (h :. t) -> (h :. t) -> Bool #

(/=) :: (h :. t) -> (h :. t) -> Bool #

(Ord h, Ord t) => Ord (h :. t) Source # 
Instance details

Defined in Hpgsql.Types

Methods

compare :: (h :. t) -> (h :. t) -> Ordering #

(<) :: (h :. t) -> (h :. t) -> Bool #

(<=) :: (h :. t) -> (h :. t) -> Bool #

(>) :: (h :. t) -> (h :. t) -> Bool #

(>=) :: (h :. t) -> (h :. t) -> Bool #

max :: (h :. t) -> (h :. t) -> h :. t #

min :: (h :. t) -> (h :. t) -> h :. t #

(FromPgRow a, FromPgRow b) => FromPgRow (a :. b) Source # 
Instance details

Defined in Hpgsql.Types

Methods

rowDecoder :: RowDecoder (a :. b) Source #

(ToPgRow a, ToPgRow b) => ToPgRow (a :. b) Source # 
Instance details

Defined in Hpgsql.Types

Methods

rowEncoder :: RowEncoder (a :. b) Source #

pgJsonByteString :: PgJson -> ByteString Source #

A valid UTF8 representation of the JSON value.