avro_obj_t (avro_schema_t)
|
avro_xxx_schema_t
sturct avro_obj_t {}
struct avro_xxx_schema_t {
struct avro_obj_t obj;
...
};
通过这样来实现'多态'。
支持如下的 field type:
string
bytes
int32
int64
float
double
boolean
null
record, structure
enum
fixed, 固定大小的string
map
array
union
link
// 从 jsontext 中,创建 schema。不支持直接从文件中读 jsontext,这个要自己写代码支持。
int avro_schema_from_json(const char *jsontext, const int32_t len, avro_schema_t * schema, avro_schema_error_t * e)
// 从 schema 生成 json,写入 out 中。out 可能是 file or memory。
int avro_schema_to_json(avro_schema_t schema, avro_writer_t out)
// 对比两个 schema 是否相同
int avro_schema_equal(avro_schema_t a, avro_schema_t b)
评论