-
Notifications
You must be signed in to change notification settings - Fork 87
/
headerworks_data_container.go
48 lines (40 loc) · 1.08 KB
/
headerworks_data_container.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Code generated by github.com/actgardner/gogen-avro. DO NOT EDIT.
/*
* SOURCE:
* namespace.avsc
*/
package avro
import (
"io"
"github.com/actgardner/gogen-avro/container"
"github.com/actgardner/gogen-avro/vm"
"github.com/actgardner/gogen-avro/compiler"
)
func NewHeaderworksDataWriter(writer io.Writer, codec container.Codec, recordsPerBlock int64) (*container.Writer, error) {
t := HeaderworksData{}
return container.NewWriter(writer, codec, recordsPerBlock, t.Schema())
}
// container reader
type HeaderworksDataReader struct {
r io.Reader
p *vm.Program
}
func NewHeaderworksDataReader(r io.Reader) (*HeaderworksDataReader, error){
containerReader, err := container.NewReader(r)
if err != nil {
return nil, err
}
t := HeaderworksData{}
deser, err := compiler.CompileSchemaBytes([]byte(containerReader.AvroContainerSchema()), []byte(t.Schema()))
if err != nil {
return nil, err
}
return &HeaderworksDataReader {
r: containerReader,
p: deser,
}, nil
}
func (r HeaderworksDataReader) Read() (t HeaderworksData, err error) {
err = vm.Eval(r.r, r.p, &t)
return
}