Movatterモバイル変換


[0]ホーム

URL:


protodesc

package
v1.36.11Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License:BSD-3-ClauseImports:20Imported by:552

Details

Repository

github.com/protocolbuffers/protobuf-go

Links

Documentation

Overview

Package protodesc provides functionality for convertingFileDescriptorProto messages to/fromprotoreflect.FileDescriptor values.

The google.protobuf.FileDescriptorProto is a protobuf message that describesthe type information for a .proto file in a form that is easily serializable.Theprotoreflect.FileDescriptor is a more structured representation ofthe FileDescriptorProto message where references and remote dependenciescan be directly followed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcNewFile

NewFile creates a newprotoreflect.FileDescriptor from the providedfile descriptor message. SeeFileOptions.New for more information.

funcNewFilesadded inv1.21.0

NewFiles creates a newprotoregistry.Files from the providedFileDescriptorSet message. SeeFileOptions.NewFiles for more information.

funcToDescriptorProto

ToDescriptorProto copies aprotoreflect.MessageDescriptor into agoogle.protobuf.DescriptorProto message.

funcToEnumDescriptorProto

ToEnumDescriptorProto copies aprotoreflect.EnumDescriptor into agoogle.protobuf.EnumDescriptorProto message.

funcToEnumValueDescriptorProto

ToEnumValueDescriptorProto copies aprotoreflect.EnumValueDescriptor into agoogle.protobuf.EnumValueDescriptorProto message.

funcToFieldDescriptorProto

ToFieldDescriptorProto copies aprotoreflect.FieldDescriptor into agoogle.protobuf.FieldDescriptorProto message.

funcToFileDescriptorProto

ToFileDescriptorProto copies aprotoreflect.FileDescriptor into agoogle.protobuf.FileDescriptorProto message.

funcToMethodDescriptorProto

ToMethodDescriptorProto copies aprotoreflect.MethodDescriptor into agoogle.protobuf.MethodDescriptorProto message.

funcToOneofDescriptorProto

ToOneofDescriptorProto copies aprotoreflect.OneofDescriptor into agoogle.protobuf.OneofDescriptorProto message.

funcToServiceDescriptorProto

func ToServiceDescriptorProto(serviceprotoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto

ToServiceDescriptorProto copies aprotoreflect.ServiceDescriptor into agoogle.protobuf.ServiceDescriptorProto message.

Types

typeFileOptions

type FileOptions struct {pragma.NoUnkeyedLiterals// AllowUnresolvable configures New to permissively allow unresolvable// file, enum, or message dependencies. Unresolved dependencies are replaced// by placeholder equivalents.//// The following dependencies may be left unresolved://• Resolving an imported file.//• Resolving the type for a message field or extension field.//If the kind of the field is unknown, then a placeholder is used for both//the Enum and Message accessors on the protoreflect.FieldDescriptor.//• Resolving an enum value set as the default for an optional enum field.//If unresolvable, the protoreflect.FieldDescriptor.Default is set to the//first value in the associated enum (or zero if the also enum dependency//is also unresolvable). The protoreflect.FieldDescriptor.DefaultEnumValue//is populated with a placeholder.//• Resolving the extended message type for an extension field.//• Resolving the input or output message type for a service method.//// If the unresolved dependency uses a relative name,// then the placeholder will contain an invalid FullName with a "*." prefix,// indicating that the starting prefix of the full name is unknown.AllowUnresolvablebool}

FileOptions configures the construction of file descriptors.

func (FileOptions)New

New creates a newprotoreflect.FileDescriptor from the providedfile descriptor message. The file must represent a valid proto file accordingto protobuf semantics. The returned descriptor is a deep copy of the input.

Any imported files, enum types, or message types referenced in the file areresolved using the provided registry. When looking up an import file path,the path must be unique. The newly created file descriptor is not registeredback into the provided file registry.

func (FileOptions)NewFilesadded inv1.21.0

NewFiles creates a newprotoregistry.Files from the providedFileDescriptorSet message. The descriptor set must include onlyvalid files according to protobuf semantics. The returned descriptorsare a deep copy of the input.

typeResolver

type Resolver interface {FindFileByPath(string) (protoreflect.FileDescriptor,error)FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor,error)}

Resolver is the resolver used byNewFile to resolve dependencies.The enums and messages provided must belong to some parent file,which is also registered.

It is implemented byprotoregistry.Files.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp