csvpb

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package csvpb provides unmarshaling between protocol buffers and RFC 4180.

Package csvpb provides unmarshaling between protocol buffers and RFC 4180.

Index

Constants

View Source
const (
	NONE = iota
	BOOL
	DOUBLE
	FLOAT
	INT32
	INT64
	STRING
	UINT32
	UINT64
)

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(r io.Reader, pb proto.Message) error

Unmarshal unmarshals a JSON object stream into a protocol buffer. This function is lenient and will decode any options permutations of the related Marshaler.

func UnmarshalNext

func UnmarshalNext(dec *Decoder, pb proto.Message) error

UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. This function is lenient and will decode any options permutations of the related Marshaler.

func UnmarshalString

func UnmarshalString(str string, pb proto.Message) error

UnmarshalString will populate the fields of a protocol buffer based on a JSON string. This function is lenient and will decode any options permutations of the related Marshaler.

Types

type CSVPBUnmarshaler

type CSVPBUnmarshaler interface {
	UnmarshalJSONPB(*Unmarshaler, []byte) error
}

CSVPBUnmarshaler is implemented by protobuf messages that customize the way they are unmarshaled from CSV. Messages that implement this should also implement CSVPBMarshaler so that the custom format can be produced.

type Decoder

type Decoder struct {
	Reader *csv.Reader
}

Only decodes value lines

func NewDecoder

func NewDecoder(csvReader *csv.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode() ([]string, error)

type InvalidUnmarshalError

type InvalidUnmarshalError struct {
	Type reflect.Type
}

An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. (The argument to Unmarshal must be a non-nil pointer.)

func (*InvalidUnmarshalError) Error

func (e *InvalidUnmarshalError) Error() string

type RawMessage

type RawMessage = []string

type Unmarshaler

type Unmarshaler struct {
	// Whether to allow messages to contain unknown fields, as opposed to
	// failing to unmarshal.
	AllowUnknownFields bool

	Header []string
}

Unmarshaler is a configurable object for converting from a CSV representation to a protocol buffer object.

func (*Unmarshaler) Unmarshal

func (u *Unmarshaler) Unmarshal(r io.Reader, pb proto.Message) error

Unmarshal unmarshals a CSV object stream into a protocol buffer. This function is lenient and will decode any options permutations of the related Marshaler.

func (*Unmarshaler) UnmarshalNext

func (u *Unmarshaler) UnmarshalNext(dec *Decoder, pb proto.Message) error

UnmarshalNext unmarshals the next protocol buffer from a CSV. This function is lenient and will decode any options permutations of the related Marshaler.

Jump to

Keyboard shortcuts

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