Documentation ¶
Overview ¶
Package protocp transforms one record-oriented format into another record-oriented format where the records are protocol buffers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Copier ¶
type Copier struct {
// contains filtered or unexported fields
}
Copier converts an input record-oriented stream to another record-oriented stream.
func NewCopier ¶
func NewCopier(newMessageReader func(io.Reader) (MessageReader, error)) *Copier
NewCopier returns a CSV converter for the given CSV path and reader/writer generators.
newMessageReader returns a function for iterating through csv records as proto.Message instances. newMessageWriter returns a MessageWriter for writing the messages to some output sink.
func (*Copier) Copy ¶
Copy translates each CSV line into a proto.Message and outputs all the protos to a record-oriented writer.
func (*Copier) CopyFile ¶
func (cp *Copier) CopyFile(ctx context.Context, fs FileSystem, fileName string, writer MessageWriter) (finalErr error)
CopyFile opens a file, translates each record of the file into a proto.Message, and outputs all the protos to an output MessageWriter.
type FileSystem ¶
FileSystem provides a file system abstraction in the context of protocp.
type MessageReader ¶
type MessageReader interface { // ReadMessage returns the next message in the stream. ReadMessage() (proto.Message, error) }
MessageReader iterates through proto messages.
type MessageWriter ¶
type MessageWriter interface {
// contains filtered or unexported methods
}
MessageWriter is a generic interface for writing output protos to some record-oriented format.
func NewCompositeRecordWriter ¶
func NewCompositeRecordWriter(writers ...MessageWriter) MessageWriter
NewCompositeRecordWriter returns a MessageWriter that dispatches to several other record writers.