Safe Haskell | None |
---|---|
Language | Haskell2010 |
The types in this module have invariants which cannot be checked if their constructors are in scope. Preql.Wire exports the type names only.
Synopsis
- newtype Query = Query ByteString
- data RowDecoder a = RowDecoder [PgType] (InternalDecoder a)
- type InternalDecoder = StateT DecoderState (ExceptT FieldError IO)
- data DecoderState = DecoderState {}
- decodeRow :: RowDecoder a -> Result -> Row -> ExceptT FieldError IO a
- getNextValue :: InternalDecoder (Maybe ByteString)
Documentation
The IsString instance does no validation; the limited instances discourage directly manipulating strings, with the high risk of SQL injection.
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 Postgres.
RowDecoder [PgType] (InternalDecoder a) |
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 # |
type InternalDecoder = StateT DecoderState (ExceptT FieldError IO) Source #
Internal because we need IO for the libpq FFI, but we promise not
to do any IO besides decoding. We don't even make network calls to
Postgres in InternalDecoder
data DecoderState Source #
Instances
Eq DecoderState Source # | |
Defined in Preql.Wire.Internal (==) :: DecoderState -> DecoderState -> Bool # (/=) :: DecoderState -> DecoderState -> Bool # | |
Show DecoderState Source # | |
Defined in Preql.Wire.Internal showsPrec :: Int -> DecoderState -> ShowS # show :: DecoderState -> String # showList :: [DecoderState] -> ShowS # |
decodeRow :: RowDecoder a -> Result -> Row -> ExceptT FieldError IO a Source #