Functions for de/serializing data with Avro.
Functions for de/serializing data with Avro.
Like clojure.core/*data-readers*
, but for reading Avro records.
Initializes with merged contents of avro_readers.clj
resources.
Whenever an Avro record is deserialized, the Clojure datum reader will
check this map for a key matching the Avro record name represented as
a namespace-qualified symbol. When found, the datum reader will
invoke the associated value as a function on the deserialized record's
fields as positional arguments. The datum reader will use the return
value as the deserialization result.
Like `clojure.core/*data-readers*`, but for reading Avro records. Initializes with merged contents of `avro_readers.clj` resources. Whenever an Avro record is deserialized, the Clojure datum reader will check this map for a key matching the Avro record name represented as a namespace-qualified symbol. When found, the datum reader will invoke the associated value as a function on the deserialized record's fields as positional arguments. The datum reader will use the return value as the deserialization result.
Protocol for customizing Avro serialization.
Protocol for customizing Avro serialization.
(field-get this field)
Value of keyword field
for Avro serialization of object.
Value of keyword `field` for Avro serialization of object.
(field-list this)
List of keyword fields this object provides.
List of keyword fields this object provides.
(schema-name this)
Full package-/namespace-qualified name for Avro purposes.
Full package-/namespace-qualified name for Avro purposes.
(binary-decoder source)
Return a binary-encoding decoder for source
. The source
may be
an input stream, a byte array, or a vector of [bytes off len]
.
Return a binary-encoding decoder for `source`. The `source` may be an input stream, a byte array, or a vector of `[bytes off len]`.
(binary-encoded schema & records)
Return bytes produced by binary-encoding records
with schema
via encode
.
Return bytes produced by binary-encoding `records` with `schema` via `encode`.
(binary-encoder sink)
Return a binary-encoding encoder for sink
.
Return a binary-encoding encoder for `sink`.
(compare schema x y)
Compare x
and y
according to schema
.
Compare `x` and `y` according to `schema`.
(data-file-reader source)
(data-file-reader expected source)
Return an Avro DataFileReader which produces Clojure data structures.
Return an Avro DataFileReader which produces Clojure data structures.
(data-file-stream source)
(data-file-stream expected source)
Return an Avro DataFileStream which produces Clojure data structures.
Return an Avro DataFileStream which produces Clojure data structures.
(data-file-writer)
(data-file-writer sink)
(data-file-writer schema sink)
(data-file-writer codec schema sink)
Return an Avro DataFileWriter which consumes Clojure data structures.
Return an Avro DataFileWriter which consumes Clojure data structures.
(datum-reader)
(datum-reader schema)
(datum-reader expected actual)
Return an Avro DatumReader which produces Clojure data structures.
Return an Avro DatumReader which produces Clojure data structures.
(datum-writer)
(datum-writer schema)
Return an Avro DatumWriter which consumes Clojure data structures.
Return an Avro DatumWriter which consumes Clojure data structures.
(decode schema source)
Decode and return one object from source
using schema
. The
source
may be an existing Decoder object or anything on which
a (binary-encoding) Decoder may be opened.
Decode and return one object from `source` using `schema`. The `source` may be an existing Decoder object or anything on which a (binary-encoding) Decoder may be opened.
(decode-seq schema source)
As per decode
, but decode and return a sequence of all objects
decoded serially from source
.
As per `decode`, but decode and return a sequence of all objects decoded serially from `source`.
(direct-binary-decoder source)
Return a non-buffered binary-encoding decoder for source
.
Return a non-buffered binary-encoding decoder for `source`.
(direct-binary-encoder sink)
Return an unbuffered binary-encoding encoder for sink
.
Return an unbuffered binary-encoding encoder for `sink`.
(encode schema sink & records)
Serially encode each record in records
to sink
using schema
.
The sink
may be an existing Encoder object, or anything on which
a (binary-encoding) Encoder may be opened.
Serially encode each record in `records` to `sink` using `schema`. The `sink` may be an existing Encoder object, or anything on which a (binary-encoding) Encoder may be opened.
(grouping-schema n schema)
Produce a grouping schema version of record schema schema
which ignores all
but the first n
fields when sorting.
Produce a grouping schema version of record schema `schema` which ignores all but the first `n` fields when sorting.
(json-decoder schema source)
Return a JSON-encoding decoder for source
using schema
.
Return a JSON-encoding decoder for `source` using `schema`.
(json-encoded schema & records)
Return string produced by JSON-encoding records
with schema
via encode
.
Return string produced by JSON-encoding `records` with `schema` via `encode`.
(json-encoder schema sink)
Return a JSON-encoding encoder for sink
using schema
.
Return a JSON-encoding encoder for `sink` using `schema`.
(mslurp f & opts)
Like Avro slurp
, but produces a sequence of records.
Like Avro `slurp`, but produces a sequence of records.
(mspit schema f content & opts)
Like Avro spit
, but emits content
as a sequence of records.
Like Avro `spit`, but emits `content` as a sequence of records.
(parse-schema source)
(parse-schema source & sources)
Parse Avro schemas in source
and sources
. Each schema source may be a
JSON string, an input stream containing a JSON schema, a Clojure data structure
which may be converted to a JSON schema, or an already-parsed Avro schema
object. The schema for each subsequent source may refer to the types defined in
the previous schemas. The parsed schema from the final source is returned.
Parse Avro schemas in `source` and `sources`. Each schema source may be a JSON string, an input stream containing a JSON schema, a Clojure data structure which may be converted to a JSON schema, or an already-parsed Avro schema object. The schema for each subsequent source may refer to the types defined in the previous schemas. The parsed schema from the final source is returned.
Protocol for coercing to an Avro SeekableInput
.
Protocol for coercing to an Avro `SeekableInput`.
(-seekable-input x opts)
Attempt to coerce x
to an Avro SeekableInput
.
Attempt to coerce `x` to an Avro `SeekableInput`.
(schema? schema)
True iff schema
is an Avro Schema
instance.
True iff `schema` is an Avro `Schema` instance.
(seekable-input x)
(seekable-input opts x)
Attempt to coerce x
to an Avro SeekableInput
.
Attempt to coerce `x` to an Avro `SeekableInput`.
(slurp f & opts)
Like core slurp
, but reads Avro content from f
.
Like core `slurp`, but reads Avro content from `f`.
(spit schema f content & opts)
Like core spit
, but emits content
to f
as Avro with schema
.
Like core `spit`, but emits `content` to `f` as Avro with `schema`.
(tuple-schema types)
(tuple-schema name types)
Return Clojure-data Avro schema for record consisting of fields of the
provided types
, and optionally named name
.
Return Clojure-data Avro schema for record consisting of fields of the provided `types`, and optionally named `name`.
(unparse-schema schema)
Return Avro-normalized Clojure data version of schema
. If schema
is not
already a parsed schema, will first normalize and parse it.
Return Avro-normalized Clojure data version of `schema`. If `schema` is not already a parsed schema, will first normalize and parse it.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close