goavro

package module
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2017 License: Apache-2.0 Imports: 7 Imported by: 14

README

goavro

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Union added in v0.0.2

func Union(name string, datum interface{}) interface{}

Union wraps a datum value in a map for encoding as a Union, as required by Union encoder.

Types

type BinaryCoder

type BinaryCoder interface {
	BinaryDecoder
	BinaryEncoder
}

BinaryCoder interface describes types that expose both the Decode and the Encode methods.

type BinaryDecoder

type BinaryDecoder interface {
	BinaryDecode([]byte) (interface{}, []byte, error)
}

BinaryDecoder interface describes types that expose the Decode method.

type BinaryEncoder

type BinaryEncoder interface {
	BinaryEncode([]byte, interface{}) ([]byte, error)
}

BinaryEncoder interface describes types that expose the Encode method.

type Codec added in v0.0.6

type Codec struct {
	// contains filtered or unexported fields
}

Codec stores function pointers for encoding and decoding Avro blobs according to their defined specification. Their state is created during initialization, but then never modified, so the same Codec may be safely used in multiple go routines to encode and or decode different Avro streams concurrently.

func NewCodec

func NewCodec(schemaSpecification string) (*Codec, error)

NewCodec returns a Codec that can encode and decode the specified Avro schema.

func (Codec) BinaryDecode added in v0.0.6

func (c Codec) BinaryDecode(buf []byte) (interface{}, []byte, error)

BinaryDecode decodes the provided byte slice in accordance with the Codec's Avro schema. On success, it returns the decoded value, along with a new byte slice with the decoded bytes consumed. In other words, when decoding an Avro int that happens to take 3 bytes, the returned byte slice will be like the original byte slice, but with the first three bytes removed. On error, it returns the original byte slice without any bytes consumed and the error.

func (Codec) BinaryEncode added in v0.0.6

func (c Codec) BinaryEncode(buf []byte, datum interface{}) ([]byte, error)

BinaryEncode encodes the provided datum value in accordance with the Codec's Avro schema. It takes a byte slice to which to append the encoded bytes. On success, it returns the new byte slice with the appended byte slice. On error, it returns the original byte slice without any encoded bytes.

type ErrInvalidName

type ErrInvalidName struct {
	Message string
}

ErrInvalidName is the error returned when one or more parts of an Avro name is invalid.

func (ErrInvalidName) Error

func (e ErrInvalidName) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL