Data.Bytes.Builder.Avro

bytebuild-0.3.16.3: Build byte arrays

Safe Haskell | None
Language | Haskell2010

Data.Bytes.Builder.Avro

Contents

- Maps

Description

Builders for encoding data with Apache Avro. Most functions in this module are just aliases for other functions. Avro uses zig-zag LEB128 for all integral types.

Synopsis

- int :: Int -> Builder
- int32 :: Int32 -> Builder
- int64 :: Int64 -> Builder
- word16 :: Word16 -> Builder
- word32 :: Word32 -> Builder
- word128 :: Word128 -> Builder
- bytes :: Bytes -> Builder
- chunks :: Chunks -> Builder
- text :: Text -> Builder
- map2 :: Text -> Builder -> Text -> Builder -> Builder

# Documentation

int :: Int -> Builder #

int32 :: Int32 -> Builder #

int64 :: Int64 -> Builder #

word16 :: Word16 -> Builder #

Note: This results in a zigzag encoded number. Avro does not have unsigned types.

word32 :: Word32 -> Builder #

Note: This results in a zigzag encoded number. Avro does not have unsigned types.

word128 :: Word128 -> Builder #

Note: This results in a `fixed` encoded value of length 16. In the schema, the type must be `{"type": "fixed", "name": "...", "size": 16}`. A big-endian encoding is used.

bytes :: Bytes -> Builder #

chunks :: Chunks -> Builder #

text :: Text -> Builder #

# Maps

map2 #

Arguments

:: Text | First key
-> Builder | First value (already encoded)
-> Text | Second key
-> Builder | Second value (already encoded)
-> Builder |

Encode a map with exactly two key-value pairs. The keys are text. This is commonly used to encode the header in an avro file, which has a map with two keys: `avro.schema` and `avro.codec`.