Documentation ¶
Overview ¶
Package textproto converts text protobuffer files to and from CUE.
Note that textproto is an unofficial standard and that there are no specifications: the recommended packages are the de facto standard for the relevant programming languages and the recommended implementations may vary considerably between them.
Also, the standard text proto parsing libraries are rather buggy. Please verify that a parsing issues is not related these libraries before filing bugs with CUE.
API Status: DRAFT: API may change without notice.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A Decoder caches conversions of cue.Value between calls to its methods.
func (*Decoder) Parse ¶
Parse parses the given textproto bytes and converts them to a CUE expression, using schema as the guideline for conversion using the following rules:
- the @protobuf attribute is optional, but is necessary for:
- interpreting protobuf maps
- using a name different from the CUE name
- fields in the textproto that have no corresponding field in schema are ignored
NOTE: the filename is used for associating position information. However, currently no position information is associated with the text proto because the position information of github.com/protocolbuffers/txtpbfmt is too unreliable to be useful.
type Encoder ¶
type Encoder struct { }
Encoder marshals CUE into text proto.
func NewEncoder ¶
NewEncoder returns a new encoder, where the given options are default options.