protobuf

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package protobuf defines functionality for parsing protocol buffer definitions and instances.

TODO: this package can become public once we have found a good nest for it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(filename string, body io.Reader, c *Config) (f *ast.File, err error)

Parse parses a single proto file and returns its contents translated to a CUE file. Imports are resolved using the path define in Config. If body is not nil, it will use this as the contents of the file. Otherwise Parse will open the given file name at the fully qualified path.

The following field options are supported:

(cue.val)     string        CUE constraint for this field. The string may
                            refer to other fields in a message definition.
(cue.opt)     FieldOptions
   required   bool          Defines the field is required. Use with
                            caution.

Types

type Config

type Config struct {
	Paths []string
}

Config specifies the environment into which to parse a proto definition file.

type Error

type Error struct {
	Filename string
	Path     string
	Err      error
}

Error describes the location and cause of an error.

func (*Error) Error

func (p *Error) Error() string

func (*Error) Unwrap

func (p *Error) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL