protobuf

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Json       = "json"
	JsonIndent = "json-indent"
	Text       = "text"
	TextIndent = "text-indent"
	Hex        = "hex"
	HexIndent  = "hex-indent"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLoader

type FileLoader struct {
	// contains filtered or unexported fields
}

FileLoader is an implementation of Loader interface to load the proto files from the disk.

func NewFileLoader

func NewFileLoader(root string, files ...string) (*FileLoader, error)

NewFileLoader creates a new instance of local file loader.

func (*FileLoader) Get

func (f *FileLoader) Get(messageName string) (*dynamic.Message, error)

Get creates a new instance of the specified protocol buffer message.

The input parameter must be the fully qualified name of the message type. The method will return an error if the specified message type does not exist in the path.

func (*FileLoader) List

func (f *FileLoader) List(search *regexp.Regexp) ([]string, error)

List returns a list of all the protocol buffer messages exist in the path.

func (*FileLoader) Load

func (f *FileLoader) Load(messageName string) error

Load loads the specified message type into the local cache.

The input parameter must be the fully qualified name of the message type. The method will return an error if the specified message type does not exist in the path.

Calling load is not thread safe.

type Loader

type Loader interface {
	Load(messageName string) error
	Get(messageName string) (*dynamic.Message, error)
	List(filter *regexp.Regexp) ([]string, error)
}

Loader the interface to load and list the protocol buffer message types.

type Marshaller

type Marshaller struct {
	// contains filtered or unexported fields
}

func NewMarshaller

func NewMarshaller(format string, includeTimeStamp bool) *Marshaller

func (*Marshaller) Marshal

func (m *Marshaller) Marshal(msg *dynamic.Message, ts time.Time) ([]byte, error)

Jump to

Keyboard shortcuts

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