avrora v0.2.0 Avrora.Schema View Source
A wrapper struct around AvroEx.Schema and Confluent Schema Registry for more convinient use.
Link to this section Summary
Functions
Parses a json payload and converts it to the schema with id, erlavro formar and raw json format.
Link to this section Types
Link to this type
t()
View Source
t()
View Source
t() :: %Avrora.Schema{
id: nil | integer(),
raw_schema: String.t(),
schema: :avro.record_type(),
version: nil | integer()
}
t() :: %Avrora.Schema{ id: nil | integer(), raw_schema: String.t(), schema: :avro.record_type(), version: nil | integer() }
Link to this section Functions
Link to this function
parse(payload) View Source
Parses a json payload and converts it to the schema with id, erlavro formar and raw json format.
Examples
iex> json = ~s({"namespace":"io.confluent","type":"record","name":"Payment","fields":[{"name":"id","type":"string"},{"name":"amount","type":"double"}]})
iex> {:ok, avro} = Avrora.Schema.parse(json)
iex> {_, _, _, _, _, _, full_name, _} = avro.schema
iex> full_name
"io.confluent.Payment"