Functions for Clojure Spec to Avro schema conversion, encoding and decoding.
Functions for Clojure Spec to Avro schema conversion, encoding and decoding.
(->avro-schema spec-k)
Generates an Avro schema for spec-k
.
spec-k
: the key of the Spec to convert
Generates an Avro schema for `spec-k`. `spec-k`: the key of the Spec to convert
Returns a tuple: [::spec->avro-ref
::avro-schema
].
The ::spec->avro-ref
map is updated in any calls that define Avro named
types, so that schemas are only defined on the first instance and then
referred to by fully qualified name.
NOTE: you shouldn't need to call this directly, but you can extend this multimethod to implement schema generation for specs that aren't included here.
Returns a tuple: [`::spec->avro-ref` `::avro-schema`]. The `::spec->avro-ref` map is updated in any calls that define Avro named types, so that schemas are only defined on the first instance and then referred to by fully qualified name. NOTE: you shouldn't need to call this directly, but you can extend this multimethod to implement schema generation for specs that aren't included here.
(binary-encoded spec-k & records)
See abracad.avro/binary-encoded
.
See `abracad.avro/binary-encoded`.
(enum? x)
Specs defined as non-empty, keyword-only sets are ::enum
s.
::enum
s are used for defining a finite set of choices and are converted to
Avro :enum
s. An example would be:
`(s/def ::color #{:red :green :blue})'
Specs defined as non-empty, keyword-only sets are `::enum`s. `::enum`s are used for defining a finite set of choices and are converted to Avro `:enum`s. An example would be: `(s/def ::color #{:red :green :blue})'
(post-deserialize spec-k v)
Processes a deserailized value v
from Avro.
For example, it converts bytes to a BigDecimal
for an Avro :decimal
,
integers to Instants
for :timestamp-millis
and so on, according to the
Avro specification.
Processes a deserailized value `v` from Avro. For example, it converts bytes to a `BigDecimal` for an Avro `:decimal`, integers to `Instants` for `:timestamp-millis` and so on, according to the Avro specification.
See post-deserialize
.
NOTE: you shouldn't need to call this directly, but you can extend this multimethod to implement value post-deserialization for specs that aren't included here.
See `post-deserialize`. NOTE: you shouldn't need to call this directly, but you can extend this multimethod to implement value post-deserialization for specs that aren't included here.
(pre-serialize spec-k v)
Prepares a value v
for encoding to Avro.
For example, it converts BigDecimal
s to bytes for Avro :decimal
s,
:timestamp-millis
to integers and so on, according to the Avro
specification.
Prepares a value `v` for encoding to Avro. For example, it converts `BigDecimal`s to bytes for Avro `:decimal`s, `:timestamp-millis` to integers and so on, according to the Avro specification.
See pre-serialize
.
NOTE: you shouldn't need to call this directly, but you can extend this multimethod to implement value pre-serialization for specs that aren't included here.
See `pre-serialize`. NOTE: you shouldn't need to call this directly, but you can extend this multimethod to implement value pre-serialization for specs that aren't included here.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close