Documentation ¶
Overview ¶
Package recordinfer guesses the types of record columns and uses these to generate a RecordProtoMapping object that in turn may be used to generate a .proto definition and record-to-proto parser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InferredProto ¶
type InferredProto struct {
// contains filtered or unexported fields
}
InferredProto contains the results of a record oriented inference process. The structure contains type information to describe the record schema and how these fields map to proto message fields.
func (*InferredProto) Code ¶
func (ip *InferredProto) Code() string
Code returns the source for a .proto file.
func (*InferredProto) FormattedMapping ¶
func (ip *InferredProto) FormattedMapping(template *pb.RecordProtoMapping) string
FormattedMapping returns a text proto formatted version of inferred mapping based on the given template.
func (*InferredProto) Mapping ¶
func (ip *InferredProto) Mapping() *pb.RecordProtoMapping
Mapping returns a protobuf representation of the inferred mapping between Record and proto. This mapping may be manually adjusted by the user before a code generation step, if desired.
type Options ¶
type Options struct { // MessageName is the name of the output message. This name should be a short name, // not a fully qualified name. MessageName string // The value to use in the package statement of the output .proto file. PackageName string // An values to be used in the GoOptions output mapping. // See http://cs/symbol:csvtoproto.GoOptions. GoPackageName, GoProtoImport string // TimestampLocation is the time zone name used to parse timestamps that do not have an explicit timezone. TimestampLocation *time.Location }
Options contains inference configuration parameters.
type RecordBasedInferrer ¶
type RecordBasedInferrer struct {
// contains filtered or unexported fields
}
RecordBasedInferrer provides a builder interface to an InferredProto.
func NewRecordBasedInferrer ¶
func NewRecordBasedInferrer(opts *Options) *RecordBasedInferrer
NewRecordBasedInferrer creates a new RecordBasedInferrer.
func (*RecordBasedInferrer) AddRow ¶
func (b *RecordBasedInferrer) AddRow(row []string) error
AddRow appends a row to the builder's set of rows. Returns an error if the number of columns in the new row does not match the number of columns in the first row added.
func (*RecordBasedInferrer) Build ¶
func (b *RecordBasedInferrer) Build() (*InferredProto, error)
Build constructs an InferredProto using the builder's internal data.