hasql-interpolate-0.1.0.0: QuasiQuoter that supports expression interpolation for hasql
Safe HaskellNone
LanguageHaskell2010

Hasql.Interpolate.Internal.Encoder

Synopsis

Documentation

class EncodeValue a where Source #

This type class determines which encoder we will apply to a field by its type.

Example

Expand
data ThreatLevel = None | Midnight

instance EncodeValue ThreatLevel where
  encodeValue = enum \case
    None     -> "none"
    Midnight -> "midnight"

Instances

Instances details
EncodeValue Bool Source #

Encode a Bool as a postgres boolean using bool

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Char Source #

Encode a Char as a postgres char using char

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Double Source #

Encode a Double as a postgres float8 using float8

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Float Source #

Encode a Float as a postgres float4 using float4

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Int16 Source #

Encode a Int16 as a postgres int2 using int2

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Int32 Source #

Encode a Int32 as a postgres int4 using int4

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Int64 Source #

Encode a Int64 as a postgres int8 using int8

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Scientific Source #

Encode a Scientific as a postgres numeric using numeric

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Text Source #

Encode a Text as a postgres text using text

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue UTCTime Source #

Encode a UTCTime as a postgres timestamptz using timestamptz

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue UUID Source #

Encode a UUID as a postgres uuid using uuid

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Day Source #

Encode a Day as a postgres date using date

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue DiffTime Source #

Encode a DiffTime as a postgres interval using interval

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue LocalTime Source #

Encode a LocalTime as a postgres timestamp using timestamp

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue Json Source #

Encode an Aeson Value to a postgres json using json

Instance details

Defined in Hasql.Interpolate.Internal.Json

EncodeValue Jsonb Source #

Encode an Aeson Value to a postgres jsonb using jsonb

Instance details

Defined in Hasql.Interpolate.Internal.Json

EncodeField a => EncodeValue [a] Source #

Encode a list as a postgres array using foldableArray

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

Methods

encodeValue :: Value [a] Source #

EncodeField a => EncodeValue (Vector a) Source #

Encode a Vector as a postgres array using foldableArray

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

ToJSON a => EncodeValue (AsJsonb a) Source #

Encode anything that is an instance of ToJSON to a postgres jsonb

Instance details

Defined in Hasql.Interpolate.Internal.Json

ToJSON a => EncodeValue (AsJson a) Source #

Encode anything that is an instance of ToJSON to a postgres json

Instance details

Defined in Hasql.Interpolate.Internal.Json

class EncodeField a where Source #

You do not need to define instances for this class; The two instances exported here cover all uses. The class only exists to lift Value to hasql's NullableOrNot GADT.

Instances

Instances details
EncodeValue a => EncodeField a Source #

Overlappable instance for all non-nullable types.

Instance details

Defined in Hasql.Interpolate.Internal.Encoder

EncodeValue a => EncodeField (Maybe a) Source #

Instance for all nullable types. Nothing is encoded as null.

Instance details

Defined in Hasql.Interpolate.Internal.Encoder