avro_typemap: avro_typemap

Description Usage Arguments Value Examples

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

1

Arguments

...

key-value pairs of Avro type schemas

Value

a function that yields Avro type schemas or just their names

Examples

1
2
3
4
5
6
7
8
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

aurelius documentation built on May 2, 2019, 3:43 a.m.