protoutil

package
v1.7.0-dev-20191018 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: Apache-2.0 Imports: 7 Imported by: 8 modules, 58 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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