Documentation ¶
Overview ¶
Package csvpb provides unmarshaling between protocol buffers and RFC 4180.
Package csvpb provides unmarshaling between protocol buffers and RFC 4180.
Index ¶
Constants ¶
const ( NONE = iota BOOL DOUBLE FLOAT INT32 INT64 STRING UINT32 UINT64 )
Variables ¶
This section is empty.
Functions ¶
func SplitReaderSequential ¶ added in v0.0.3
SplitReaderSequential splits the input reader by a seperator. Returns a first Reader for reading everything until first occurence of said separator. Also a second Reader for everything after first occurence of said operator. Second Reader will only start once all of first reader was consumed.
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 {
// contains filtered or unexported fields
}
Decoder decodes single line
func NewDecoder ¶
NewDecoder creates a new Decoder. Internal state is implementation detail.
type InvalidUnmarshalError ¶
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 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 ¶
Unmarshal unmarshals a CSV object stream into a protocol buffer. This function is lenient and will decode any options permutations of the related Marshaler. Will panic, should Header be nil.
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. Will panic, should Header be nil or Decoder have nothing to actually decode
func (*Unmarshaler) UnmarshalString ¶ added in v0.0.3
func (u *Unmarshaler) UnmarshalString(str string, pb proto.Message) error
UnmarshalString will populate the fields of a protocol buffer based on a CSV string. This function is lenient and will decode any options permutations of the related Marshaler. Will panic, should Header be nil.