Closed johntdyer closed 6 years ago
Hello guys, I just wanted to follow up on this and see if anyone had any thoughts on what I am doing wrong here ?
Hey, it's been a while since I've logged in to check up and just say your question.
First off I do recommend using goavro/v2
. It's 3--4x faster on some really super conflated payloads here at my present employment, and provides a much easier to use API, especially for records. In v2
you simply create and populate a Go map[string]interface{}
data structure with your record's values and feed that to the encoder. And when decoding a record, the decover returns a Go map[string]interface{}
back to you, with all of the keys and values put in their proper places. See the example file at https://github.com/linkedin/goavro/blob/master/examples/nested/main.go.
Second, I know v2
has the following feature, and I'm not sure whether the original API had it, but the newer versions of the encoder provide the syntactic sugar that you were surprised did not exist in your question above. As you know, an array of strings should be allowed by the encoder rather than an array of empty interfaces, each of which is a string. This is allowed in the v2
encoder. See the example using a slice of int
values in the test case: https://github.com/linkedin/goavro/blob/master/array_test.go#L83
I'm going to close this issue, and I regret the delay, but please re-open if you have any additional questions.
Hello,
I am getting the following error when trying to encode an array , I am not sure why, hoping its just me doing something stupid.
Error
Code
Schema