KVEncode provides encoders to turn things into list of (String, String)
which can be used to build headers or query parameters. The encoding is one that
is accepted by many AWS services.
When encoding records (or objects) the following scheme is used:
A field with a simple value is encoded like this:
( "Field", "value" )A field with a list of simple values is encoded like this:
[ ( "Field.member.1", "value1" )
, ( "Field.member.2", "value2" )
, ...
]A field with a single object value is encoded like this:
[ ( "Field.InnerField1", "innerValue1" )
, ( "Field.InnerField2", "innerValue2" )
, ...
]A field with a list of object values is encoded like this:
[ ( "Field.member.1.InnerField1", "innerValue1" )
, ( "Field.member.1.InnerField2", "innerValue2" )
, ...
]A field of a record to be encoded in (String, String) form.
Encodes a set of KV pairs into List (String, String) form.
The keys in the output may be compound to describe a path through objects and arrays into some deeper data structure. The possible formats are described in the module level documentation above.
Note that only KVPairs that have keys are encoded by this. Simple values or
lists do not have keys and will result in [] being returned. This only produces
a non-empty result if the top-level KVPair passed in, describes an object.
Combines a Dict with an encoder for its values into a set of KVPairs.
Encodes a pair of (String, Maybe a) into KVPairs.
Values that are Nothing are not encoded in the output, they are skipped over.
Describes pairs of
(String, String)tuples.Note that this data structure also allows values on their own with no keys for the convenience of keeping this API in a similar shape to JSON encoders.