protoutil

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2017 License: Apache-2.0 Imports: 7 Imported by: 58

Documentation

Overview

Package protoutil adds some helpers that makes using protobuf structures a little easier.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescriptorOf

func DescriptorOf(msg Described) (*descriptor.DescriptorProto, error)

DescriptorOf returns the descriptor for a given proto message.

func GetFileDescriptor

func GetFileDescriptor(data []byte) (*descriptor.FileDescriptorProto, error)

func OneOf

func OneOf(v interface{}) interface{}

OneOf returns the value of a oneof proto field. For example, given the proto:

message M {
  oneof o {
    A a = 1;
    B b = 2;
    C c = 3;
  }
}

OneOf(m.o) will return either a, b, c or nil, skipping the wrapper struct.

Types

type Described

type Described interface {
	Descriptor() ([]byte, []int)
}

Described is the interface to something that self describes with a compressed FileDescriptorProto.

Directories

Path Synopsis
Package testprotos provides some proto messages that can be used for tests.
Package testprotos provides some proto messages that can be used for tests.

Jump to

Keyboard shortcuts

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