Description
I'm attaching a patch that adds a slew of new accessor and mutators methods to the C API. I think this is basically complete — any useful piece of information about any of the schema or datum types can now be retrieved and set.
Some notes from the commit message:
- You can create the appropriate avro_datum_t instance for an
arbitrary schema with the new avro_datum_from_schema() function.
For records, this includes creating a datum instance for each of the
record's fields. Arrays and maps are initially created empty, while
a union is created with none of its branches initially selected.
This prevents the function from going into an endless loop for
recursive schemas.
- The active branch of a union can now be changed. If the desired
branch is already active, this has no result. Otherwise, a new
avro_datum_t is created for the new branch.
- Map values can now be accessed by index as well as by key. The
index of a map entry is based on the order that it was added to the
map.
- Enum values can be retrieved or set either by integer value or by
symbol name.
A couple of the new functions need access to the schema of a datum in
order to work. These functions take in the schema instance as an extra
parameter. A better solution might be to include a reference to a
schema object in each avro_datum_t instance.
Attachments
Attachments
Issue Links
- is required by
-
AVRO-729 JSON encoded Avro values
- Closed