Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Kafka.Avro.Decode
Synopsis
- data DecodeError
- decode :: forall a m. (MonadIO m, HasAvroSchema a, FromAvro a) => SchemaRegistry -> ByteString -> m (Either DecodeError a)
- decodeWithSchema :: forall a m. (MonadIO m, FromAvro a) => SchemaRegistry -> Schema -> ByteString -> m (Either DecodeError a)
- extractSchemaId :: ByteString -> Maybe (SchemaId, ByteString)
Documentation
data DecodeError Source #
Constructors
DecodeRegistryError SchemaRegistryError | |
BadPayloadNoSchemaId | |
DecodeError Schema String | |
IncompatibleSchema Schema String |
Instances
Show DecodeError Source # | |
Defined in Kafka.Avro.Decode Methods showsPrec :: Int -> DecodeError -> ShowS # show :: DecodeError -> String # showList :: [DecodeError] -> ShowS # | |
Eq DecodeError Source # | |
Defined in Kafka.Avro.Decode |
decode :: forall a m. (MonadIO m, HasAvroSchema a, FromAvro a) => SchemaRegistry -> ByteString -> m (Either DecodeError a) Source #
Decodes a provided Avro-encoded value. The serialised value is expected to be in a "confluent-compatible" format where the "real" value bytestring is prepended with extra 5 bytes: a "magic" byte and 4 bytes representing the schema ID.
decodeWithSchema :: forall a m. (MonadIO m, FromAvro a) => SchemaRegistry -> Schema -> ByteString -> m (Either DecodeError a) Source #
extractSchemaId :: ByteString -> Maybe (SchemaId, ByteString) Source #