avro-0.4.7.0: Avro serialization support for Haskell

Safe HaskellNone
LanguageHaskell2010

Data.Avro.Encode

Contents

Synopsis

High level interface

getSchema :: forall a. EncodeAvro a => a -> Schema Source #

encodeContainer :: EncodeAvro a => Codec -> Schema -> [[a]] -> IO ByteString Source #

Encode chunks of objects into a container, using 16 random bytes for the synchronization markers. Blocks are compressed (or not) according to the given Codec (nullCodec or deflateCodec).

newSyncBytes :: IO ByteString Source #

Generates a new synchronization marker for encoding Avro containers

encodeContainerWithSync :: EncodeAvro a => Codec -> Schema -> ByteString -> [[a]] -> ByteString Source #

Encode chunks of objects into a container, using the provided ByteString as the synchronization markers.

Packing containers

containerHeaderWithSync :: Codec -> Schema -> ByteString -> Builder Source #

Creates an Avro container header for a given schema.

packContainerBlocks :: Codec -> Schema -> [(Int, ByteString)] -> IO ByteString Source #

Packs a new container from a list of already encoded Avro blocks. Each block is denoted as a pair of a number of objects within that block and the block content.

packContainerBlocksWithSync :: Codec -> Schema -> ByteString -> [(Int, ByteString)] -> ByteString Source #

Packs a new container from a list of already encoded Avro blocks. Each block is denoted as a pair of a number of objects within that block and the block content.

packContainerValues :: Codec -> Schema -> [[ByteString]] -> IO ByteString Source #

Packs a container from a given list of already encoded Avro values Each bytestring should represent exactly one one value serialised to Avro.

packContainerValuesWithSync :: Codec -> Schema -> ByteString -> [[ByteString]] -> ByteString Source #

Packs a container from a given list of already encoded Avro values Each bytestring should represent exactly one one value serialised to Avro.

Lower level interface

class EncodeAvro a where Source #

Methods

avro :: a -> AvroM Source #

Instances
EncodeAvro Bool Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Bool -> AvroM Source #

EncodeAvro Double Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Double -> AvroM Source #

EncodeAvro Float Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Float -> AvroM Source #

EncodeAvro Int Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Int -> AvroM Source #

EncodeAvro Int8 Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Int8 -> AvroM Source #

EncodeAvro Int16 Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Int16 -> AvroM Source #

EncodeAvro Int32 Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Int32 -> AvroM Source #

EncodeAvro Int64 Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Int64 -> AvroM Source #

EncodeAvro Word8 Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Word8 -> AvroM Source #

EncodeAvro Word16 Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Word16 -> AvroM Source #

EncodeAvro Word32 Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Word32 -> AvroM Source #

EncodeAvro Word64 Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Word64 -> AvroM Source #

EncodeAvro () Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: () -> AvroM Source #

EncodeAvro ByteString Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: ByteString -> AvroM Source #

EncodeAvro ByteString Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: ByteString -> AvroM Source #

EncodeAvro Text Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Text -> AvroM Source #

EncodeAvro Text Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Text -> AvroM Source #

EncodeAvro String Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: String -> AvroM Source #

EncodeAvro DiffTime Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: DiffTime -> AvroM Source #

EncodeAvro Day Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Day -> AvroM Source #

EncodeAvro UUID Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: UUID -> AvroM Source #

EncodeAvro a => EncodeAvro [a] Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: [a] -> AvroM Source #

EncodeAvro a => EncodeAvro (Maybe a) Source #

Maybe is modeled as a sum type `{null, a}`.

Instance details

Defined in Data.Avro.Encode

Methods

avro :: Maybe a -> AvroM Source #

EncodeAvro a => EncodeAvro (Set a) Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Set a -> AvroM Source #

(Unbox a, EncodeAvro a) => EncodeAvro (Vector a) Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Vector a -> AvroM Source #

EncodeAvro a => EncodeAvro (Vector a) Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Vector a -> AvroM Source #

EncodeAvro (Value Schema) Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Value Schema -> AvroM Source #

EncodeAvro a => EncodeAvro (HashMap Text a) Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: HashMap Text a -> AvroM Source #

(Ix i, EncodeAvro a) => EncodeAvro (Array i a) Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Array i a -> AvroM Source #

(KnownNat p, KnownNat s) => EncodeAvro (Decimal p s) Source # 
Instance details

Defined in Data.Avro.Encode

Methods

avro :: Decimal p s -> AvroM Source #

class Zag a where Source #

Associated Types

type Zagged a Source #

Methods

zag :: a -> Zagged a Source #

Instances
Zag Word Source # 
Instance details

Defined in Data.Avro.Zag

Associated Types

type Zagged Word :: Type Source #

Methods

zag :: Word -> Zagged Word Source #

Zag Word8 Source # 
Instance details

Defined in Data.Avro.Zag

Associated Types

type Zagged Word8 :: Type Source #

Methods

zag :: Word8 -> Zagged Word8 Source #

Zag Word16 Source # 
Instance details

Defined in Data.Avro.Zag

Associated Types

type Zagged Word16 :: Type Source #

Zag Word32 Source # 
Instance details

Defined in Data.Avro.Zag

Associated Types

type Zagged Word32 :: Type Source #

Zag Word64 Source # 
Instance details

Defined in Data.Avro.Zag

Associated Types

type Zagged Word64 :: Type Source #