A Decoder caches conversions of cue.Value between calls to its methods.
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder(option ...Option) *Decoder
NewDecoder returns a new Decoder
func (d *Decoder) Parse(schema cue.Value, filename string, b []byte) (ast.Expr, error)
Parse parses the given textproto bytes and converts them to a CUE expression, using schema as the guideline for conversion using the following rules:
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.
Encoder marshals CUE into text proto.
type Encoder struct { }
func NewEncoder(options ...Option) *Encoder
NewEncoder returns a new encoder, where the given options are default options.
func (e *Encoder) Encode(v cue.Value, options ...Option) ([]byte, error)
Encode converts a CUE value to a text proto file.
Fields do not need to have a @protobuf attribute except for in the following cases:
Option defines options for the decoder. There are currently no options.
type Option func(*options)