internal

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package internal contains some code that should not be exported but needs to be shared across more than one of the protoreflect sub-packages.

Index

Constants

This section is empty.

Variables

View Source
var StdFileAliases = map[string]string{

	"google/protobuf/any.proto":       "github.com/golang/protobuf/ptypes/any/any.proto",
	"google/protobuf/duration.proto":  "github.com/golang/protobuf/ptypes/duration/duration.proto",
	"google/protobuf/empty.proto":     "github.com/golang/protobuf/ptypes/empty/empty.proto",
	"google/protobuf/struct.proto":    "github.com/golang/protobuf/ptypes/struct/struct.proto",
	"google/protobuf/timestamp.proto": "github.com/golang/protobuf/ptypes/timestamp/timestamp.proto",
	"google/protobuf/wrappers.proto":  "github.com/golang/protobuf/ptypes/wrappers/wrappers.proto",

	"google/protobuf/api.proto":            "src/google/protobuf/api.proto",
	"google/protobuf/field_mask.proto":     "src/google/protobuf/field_mask.proto",
	"google/protobuf/source_context.proto": "src/google/protobuf/source_context.proto",
	"google/protobuf/type.proto":           "src/google/protobuf/type.proto",
}

StdFileAliases are the standard protos included with protoc, but older versions of their respective packages registered them using incorrect paths.

Functions

func DecodeFileDescriptor

func DecodeFileDescriptor(element string, fdb []byte) (*dpb.FileDescriptorProto, error)

DecodeFileDescriptor decodes the bytes of a registered file descriptor. Registered file descriptors are first "proto encoded" (e.g. binary format for the descriptor protos) and then gzipped. So this function gunzips and then unmarshals into a descriptor proto.

func GetUnrecognized

func GetUnrecognized(msg proto.Message) []byte

GetUnrecognized fetches the bytes of unrecognized fields for the given message.

func LoadFileDescriptor

func LoadFileDescriptor(file string) (*dpb.FileDescriptorProto, error)

LoadFileDescriptor loads a registered descriptor and decodes it. If the given name cannot be loaded but is a known standard name, an alias will be tried, so the standard files can be loaded even if linked against older "known bad" versions of packages.

func SetUnrecognized

func SetUnrecognized(msg proto.Message, data []byte)

SetUnrecognized adds the given bytes to the unrecognized fields for the given message.

Types

type ErrNoSuchFile

type ErrNoSuchFile string

func (ErrNoSuchFile) Error

func (e ErrNoSuchFile) Error() string

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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