View Source AvroEx.Schema (AvroEx v2.2.0)
Link to this section Summary
Functions
The fully-qualified name of the type
The namespace of the given Schema type
The name of the schema type
Link to this section Types
Specs
alias() :: name()
Specs
doc() :: nil | String.t()
Specs
full_name() :: String.t()
Specs
json_schema() :: String.t()
Specs
Specs
name() :: String.t()
Specs
named_type() :: AvroEx.Schema.Enum.t() | AvroEx.Schema.Fixed.t() | AvroEx.Schema.Record.t()
Specs
namespace() :: nil | String.t()
Specs
schema_types() :: AvroEx.Schema.Array.t() | Enum.t() | AvroEx.Schema.Fixed.t() | AvroEx.Schema.Map.t() | AvroEx.Schema.Record.t() | AvroEx.Schema.Primitive.t() | AvroEx.Schema.Union.t() | AvroEx.Schema.Reference.t()
Specs
t() :: %AvroEx.Schema{ context: AvroEx.Schema.Context.t(), schema: schema_types() | nil }
Link to this section Functions
Specs
Specs
Specs
full_name(schema_types() | name(), namespace()) :: nil | String.t()
The fully-qualified name of the type
examples
Examples
iex> full_name(%Primitive{type: "string"})
nil
iex> full_name(%Record{name: "foo", namespace: "beam.community"})
"beam.community.foo"
iex> full_name(%Record{name: "foo"}, "top.level.namespace")
"top.level.namespace.foo"
Specs
namespace(schema_types(), namespace()) :: namespace()
The namespace of the given Schema type
examples
Examples
iex> namespace(%Primitive{type: :string})
nil
iex> namespace(%Record{name: "MyRecord"}, "namespace")
"namespace"
iex> namespace(%Record{name: "MyRecord", namespace: "inner"}, "namespace")
"inner"
iex> namespace(%Record{name: "qualified.MyRecord", namespace: "inner"}, "namespace")
"qualified"
Specs
type_name(schema_types()) :: String.t()
The name of the schema type
examples
Examples
iex> type_name(%Primitive{type: "string"})
"string"
iex> type_name(%Primitive{type: :long, metadata: %{"logicalType" => "timestamp-millis"}})
"timestamp-millis"
iex> type_name(%AvroEnum{name: "switch", symbols: []})
"Enum<name=switch>"
iex> type_name(%Array{items: %Primitive{type: "int"}})
"Array<items=int>"
iex> type_name(%Fixed{size: 2, name: "double"})
"Fixed<name=double, size=2>"
iex> type_name(%Union{possibilities: [%Primitive{type: "string"}, %Primitive{type: "int"}]})
"Union<possibilities=string|int>"
iex> type_name(%Record{name: "foo"})
"Record<name=foo>"
iex> type_name(%Reference{type: "foo"})
"Reference<name=foo>"