Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module re-exports definitions from Wire.* that are expected to be useful
Synopsis
- class FromSql a
- class FromSqlField a
- class ToSql a
- class ToSqlField a
- data QueryError
- data FieldError = FieldError {}
- data UnlocatedFieldError
- data TypeMismatch = TypeMismatch {}
- data UnlocatedFieldError
- data FieldError = FieldError {}
- data TypeMismatch = TypeMismatch {}
- data QueryError
- data RowDecoder a
- data Query
- data TimeTZ = TimeTZ !TimeOfDay !TimeZone
- class ToSql a where
- toSql :: RowEncoder a
- class ToSqlField a where
- toSqlField :: FieldEncoder a
- type RowEncoder a = a -> [(Oid, ByteString)]
- data FieldEncoder a = FieldEncoder Oid (a -> Builder)
- runFieldEncoder :: FieldEncoder p -> p -> (Oid, ByteString)
- runEncoder :: RowEncoder p -> p -> [Maybe (Oid, ByteString, Format)]
- oneField :: FieldEncoder a -> RowEncoder a
- toSqlJsonField :: ToJSON a => FieldEncoder a
- class FromSql a where
- fromSql :: RowDecoder a
- class FromSqlField a where
- fromSqlField :: FieldDecoder a
- data FieldDecoder a = FieldDecoder Oid (BinaryParser a)
- throwLocated :: UnlocatedFieldError -> InternalDecoder a
- decodeVector :: RowDecoder a -> Result -> IO (Either QueryError (Vector a))
- notNull :: FieldDecoder a -> RowDecoder a
- nullable :: FieldDecoder a -> RowDecoder (Maybe a)
- fromSqlJsonField :: FromJSON a => FieldDecoder a
Decoding rows
Instances
class FromSqlField a Source #
Instances
Encoding parameters
ToSql a
is sufficient to pass a
as parameters to a paramaterized query.
Instances
class ToSqlField a Source #
Types which can be encoded to a single Postgres field.
Instances
Errors
data QueryError Source #
Instances
Eq QueryError Source # | |
Defined in Preql.Wire.Errors (==) :: QueryError -> QueryError -> Bool # (/=) :: QueryError -> QueryError -> Bool # | |
Show QueryError Source # | |
Defined in Preql.Wire.Errors showsPrec :: Int -> QueryError -> ShowS # show :: QueryError -> String # showList :: [QueryError] -> ShowS # | |
ToJSON QueryError Source # | |
Defined in Preql.Wire.Errors toJSON :: QueryError -> Value # toEncoding :: QueryError -> Encoding # toJSONList :: [QueryError] -> Value # toEncodingList :: [QueryError] -> Encoding # | |
FromJSON QueryError Source # | |
Defined in Preql.Wire.Errors parseJSON :: Value -> Parser QueryError # parseJSONList :: Value -> Parser [QueryError] # | |
Exception QueryError Source # | |
Defined in Preql.Wire.Errors toException :: QueryError -> SomeException # fromException :: SomeException -> Maybe QueryError # displayException :: QueryError -> String # |
data FieldError Source #
A decoding error with information about the row & column of the result where it occured.
Instances
Eq FieldError Source # | |
Defined in Preql.Wire.Errors (==) :: FieldError -> FieldError -> Bool # (/=) :: FieldError -> FieldError -> Bool # | |
Show FieldError Source # | |
Defined in Preql.Wire.Errors showsPrec :: Int -> FieldError -> ShowS # show :: FieldError -> String # showList :: [FieldError] -> ShowS # | |
ToJSON FieldError Source # | |
Defined in Preql.Wire.Errors toJSON :: FieldError -> Value # toEncoding :: FieldError -> Encoding # toJSONList :: [FieldError] -> Value # toEncodingList :: [FieldError] -> Encoding # | |
FromJSON FieldError Source # | |
Defined in Preql.Wire.Errors parseJSON :: Value -> Parser FieldError # parseJSONList :: Value -> Parser [FieldError] # | |
Exception FieldError Source # | |
Defined in Preql.Wire.Errors toException :: FieldError -> SomeException # fromException :: SomeException -> Maybe FieldError # displayException :: FieldError -> String # |
data UnlocatedFieldError Source #
Errors that can occur in decoding a single field.
Instances
Eq UnlocatedFieldError Source # | |
Defined in Preql.Wire.Errors (==) :: UnlocatedFieldError -> UnlocatedFieldError -> Bool # (/=) :: UnlocatedFieldError -> UnlocatedFieldError -> Bool # | |
Show UnlocatedFieldError Source # | |
Defined in Preql.Wire.Errors showsPrec :: Int -> UnlocatedFieldError -> ShowS # show :: UnlocatedFieldError -> String # showList :: [UnlocatedFieldError] -> ShowS # | |
ToJSON UnlocatedFieldError Source # | |
Defined in Preql.Wire.Errors toJSON :: UnlocatedFieldError -> Value # toEncoding :: UnlocatedFieldError -> Encoding # toJSONList :: [UnlocatedFieldError] -> Value # toEncodingList :: [UnlocatedFieldError] -> Encoding # | |
FromJSON UnlocatedFieldError Source # | |
Defined in Preql.Wire.Errors parseJSON :: Value -> Parser UnlocatedFieldError # parseJSONList :: Value -> Parser [UnlocatedFieldError] # |
data TypeMismatch Source #
Instances
Eq TypeMismatch Source # | |
Defined in Preql.Wire.Errors (==) :: TypeMismatch -> TypeMismatch -> Bool # (/=) :: TypeMismatch -> TypeMismatch -> Bool # | |
Show TypeMismatch Source # | |
Defined in Preql.Wire.Errors showsPrec :: Int -> TypeMismatch -> ShowS # show :: TypeMismatch -> String # showList :: [TypeMismatch] -> ShowS # | |
ToJSON TypeMismatch Source # | |
Defined in Preql.Wire.Errors toJSON :: TypeMismatch -> Value # toEncoding :: TypeMismatch -> Encoding # toJSONList :: [TypeMismatch] -> Value # toEncodingList :: [TypeMismatch] -> Encoding # | |
FromJSON TypeMismatch Source # | |
Defined in Preql.Wire.Errors parseJSON :: Value -> Parser TypeMismatch # parseJSONList :: Value -> Parser [TypeMismatch] # |
data UnlocatedFieldError Source #
Errors that can occur in decoding a single field.
Instances
Eq UnlocatedFieldError Source # | |
Defined in Preql.Wire.Errors (==) :: UnlocatedFieldError -> UnlocatedFieldError -> Bool # (/=) :: UnlocatedFieldError -> UnlocatedFieldError -> Bool # | |
Show UnlocatedFieldError Source # | |
Defined in Preql.Wire.Errors showsPrec :: Int -> UnlocatedFieldError -> ShowS # show :: UnlocatedFieldError -> String # showList :: [UnlocatedFieldError] -> ShowS # | |
ToJSON UnlocatedFieldError Source # | |
Defined in Preql.Wire.Errors toJSON :: UnlocatedFieldError -> Value # toEncoding :: UnlocatedFieldError -> Encoding # toJSONList :: [UnlocatedFieldError] -> Value # toEncodingList :: [UnlocatedFieldError] -> Encoding # | |
FromJSON UnlocatedFieldError Source # | |
Defined in Preql.Wire.Errors parseJSON :: Value -> Parser UnlocatedFieldError # parseJSONList :: Value -> Parser [UnlocatedFieldError] # |
data FieldError Source #
A decoding error with information about the row & column of the result where it occured.
Instances
Eq FieldError Source # | |
Defined in Preql.Wire.Errors (==) :: FieldError -> FieldError -> Bool # (/=) :: FieldError -> FieldError -> Bool # | |
Show FieldError Source # | |
Defined in Preql.Wire.Errors showsPrec :: Int -> FieldError -> ShowS # show :: FieldError -> String # showList :: [FieldError] -> ShowS # | |
ToJSON FieldError Source # | |
Defined in Preql.Wire.Errors toJSON :: FieldError -> Value # toEncoding :: FieldError -> Encoding # toJSONList :: [FieldError] -> Value # toEncodingList :: [FieldError] -> Encoding # | |
FromJSON FieldError Source # | |
Defined in Preql.Wire.Errors parseJSON :: Value -> Parser FieldError # parseJSONList :: Value -> Parser [FieldError] # | |
Exception FieldError Source # | |
Defined in Preql.Wire.Errors toException :: FieldError -> SomeException # fromException :: SomeException -> Maybe FieldError # displayException :: FieldError -> String # |
data TypeMismatch Source #
Instances
Eq TypeMismatch Source # | |
Defined in Preql.Wire.Errors (==) :: TypeMismatch -> TypeMismatch -> Bool # (/=) :: TypeMismatch -> TypeMismatch -> Bool # | |
Show TypeMismatch Source # | |
Defined in Preql.Wire.Errors showsPrec :: Int -> TypeMismatch -> ShowS # show :: TypeMismatch -> String # showList :: [TypeMismatch] -> ShowS # | |
ToJSON TypeMismatch Source # | |
Defined in Preql.Wire.Errors toJSON :: TypeMismatch -> Value # toEncoding :: TypeMismatch -> Encoding # toJSONList :: [TypeMismatch] -> Value # toEncodingList :: [TypeMismatch] -> Encoding # | |
FromJSON TypeMismatch Source # | |
Defined in Preql.Wire.Errors parseJSON :: Value -> Parser TypeMismatch # parseJSONList :: Value -> Parser [TypeMismatch] # |
data QueryError Source #
Instances
Eq QueryError Source # | |
Defined in Preql.Wire.Errors (==) :: QueryError -> QueryError -> Bool # (/=) :: QueryError -> QueryError -> Bool # | |
Show QueryError Source # | |
Defined in Preql.Wire.Errors showsPrec :: Int -> QueryError -> ShowS # show :: QueryError -> String # showList :: [QueryError] -> ShowS # | |
ToJSON QueryError Source # | |
Defined in Preql.Wire.Errors toJSON :: QueryError -> Value # toEncoding :: QueryError -> Encoding # toJSONList :: [QueryError] -> Value # toEncodingList :: [QueryError] -> Encoding # | |
FromJSON QueryError Source # | |
Defined in Preql.Wire.Errors parseJSON :: Value -> Parser QueryError # parseJSONList :: Value -> Parser [QueryError] # | |
Exception QueryError Source # | |
Defined in Preql.Wire.Errors toException :: QueryError -> SomeException # fromException :: SomeException -> Maybe QueryError # displayException :: QueryError -> String # |
data RowDecoder a Source #
RowDecoder
is Applicative
but not Monad
so that we can
assemble all of the OIDs before we read any of the field data sent
by Postgresj.
Instances
Functor RowDecoder Source # | |
Defined in Preql.Wire.Internal fmap :: (a -> b) -> RowDecoder a -> RowDecoder b # (<$) :: a -> RowDecoder b -> RowDecoder a # | |
Applicative RowDecoder Source # | |
Defined in Preql.Wire.Internal pure :: a -> RowDecoder a # (<*>) :: RowDecoder (a -> b) -> RowDecoder a -> RowDecoder b # liftA2 :: (a -> b -> c) -> RowDecoder a -> RowDecoder b -> RowDecoder c # (*>) :: RowDecoder a -> RowDecoder b -> RowDecoder b # (<*) :: RowDecoder a -> RowDecoder b -> RowDecoder a # |
The IsString instance does no validation; the limited instances discourage directly manipulating strings, with the high risk of SQL injection.
Instances
Eq TimeTZ Source # | |
Show TimeTZ Source # | |
ToSql TimeTZ Source # | |
Defined in Preql.Wire.ToSql toSql :: RowEncoder TimeTZ Source # | |
ToSqlField TimeTZ Source # | |
Defined in Preql.Wire.ToSql | |
FromSql TimeTZ Source # | |
Defined in Preql.Wire.FromSql | |
FromSqlField TimeTZ Source # | |
Defined in Preql.Wire.FromSql |
ToSql a
is sufficient to pass a
as parameters to a paramaterized query.
toSql :: RowEncoder a Source #
Instances
class ToSqlField a where Source #
Types which can be encoded to a single Postgres field.
toSqlField :: FieldEncoder a Source #
Instances
type RowEncoder a = a -> [(Oid, ByteString)] Source #
data FieldEncoder a Source #
A FieldEncoder
for a type a
consists of a function from a
to
it's binary representation, and an Postgres OID which tells
Postgres it's type & how to decode it.
FieldEncoder Oid (a -> Builder) |
Instances
Contravariant FieldEncoder Source # | |
Defined in Preql.Wire.ToSql contramap :: (a -> b) -> FieldEncoder b -> FieldEncoder a # (>$) :: b -> FieldEncoder b -> FieldEncoder a # |
runFieldEncoder :: FieldEncoder p -> p -> (Oid, ByteString) Source #
runEncoder :: RowEncoder p -> p -> [Maybe (Oid, ByteString, Format)] Source #
oneField :: FieldEncoder a -> RowEncoder a Source #
toSqlJsonField :: ToJSON a => FieldEncoder a Source #
class FromSql a where Source #
fromSql :: RowDecoder a Source #
Instances
class FromSqlField a where Source #
fromSqlField :: FieldDecoder a Source #
Instances
data FieldDecoder a Source #
A FieldDecoder
for a type a
consists of an OID indicating the
Postgres type which can be decoded, and a parser from the binary
representation of that type to the Haskell representation.
Instances
Functor FieldDecoder Source # | |
Defined in Preql.Wire.FromSql fmap :: (a -> b) -> FieldDecoder a -> FieldDecoder b # (<$) :: a -> FieldDecoder b -> FieldDecoder a # |
decodeVector :: RowDecoder a -> Result -> IO (Either QueryError (Vector a)) Source #
notNull :: FieldDecoder a -> RowDecoder a Source #
nullable :: FieldDecoder a -> RowDecoder (Maybe a) Source #
fromSqlJsonField :: FromJSON a => FieldDecoder a Source #