avro_typemap {aurelius}R Documentation

avro_typemap

Description

Convenience function for ensuring that Avro type schemas are declared exactly once. It returns a function that yields a full type declaration the first time it is invoked and just a name on subsequent times.

Usage

avro_typemap(...)

Arguments

...

key-value pairs of Avro type schemas

Value

a function that yields Avro type schemas or just their names

Examples

tm <- avro_typemap(
    MyType1 = avro_record(list(one = avro_int, two = avro_double, three = avro_string)),
    MyType2 = avro_array(avro_double)
)
tm("MyType1")           # produces the whole declaration
tm("MyType1")           # produces just "MyType1"
tm("MyType2")           # produces the whole declaration
tm("MyType2")           # produces the declaration again because this is not a named type

[Package aurelius version 0.8.4 Index]