| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Codec
Description
Synopsis
- data Col a where
- data NullCol a where
- type RowCodec = Ap NullCol
- col :: Text -> Col a -> RowCodec a
- ncol :: Text -> Col a -> RowCodec (Maybe a)
- pureVal :: a -> RowCodec a
- runCodec :: Applicative f => (forall x. NullCol x -> f x) -> RowCodec a -> f a
- codecColumns :: RowCodec a -> [Text]
- data ParamType a where
- data SomeParam where
- type Params = [SomeParam]
- pval :: Col a -> a -> SomeParam
- pnul :: Col a -> Maybe a -> SomeParam
- parr :: Col a -> [a] -> SomeParam
- pnarr :: Col a -> [Maybe a] -> SomeParam
- jobRowCodec :: Text -> RowCodec (Job Value Int64 Text UTCTime)
- dlqRowCodec :: Text -> RowCodec (Int64, UTCTime, Job Value Int64 Text UTCTime)
- countCodec :: RowCodec Int64
- statsRowCodec :: RowCodec (Int64, Int64, Maybe Double)
- cronScheduleRowCodec :: RowCodec CronScheduleRow
Column types
Scalar PostgreSQL column type. The GADT tag recovers the Haskell type.
A named column with nullability. Carries the column name for backends that use name-based decoding (e.g. orville).
Row decoding
runCodec :: Applicative f => (forall x. NullCol x -> f x) -> RowCodec a -> f a Source #
Interpret a RowCodec by providing a natural transformation
from NullCol to some Applicative.
codecColumns :: RowCodec a -> [Text] Source #
Extract the column names from a codec (in order).
Parameter encoding
An existentially-typed parameter: a ParamType paired with its value.