reflection

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFileDescriptorSet

func BuildFileDescriptorSet(descriptors []*descriptorpb.FileDescriptorProto) (*protoregistry.Files, error)

BuildFileDescriptorSet builds the file descriptor set from the descriptors.

func FetchAllDescriptors

func FetchAllDescriptors(ctx context.Context, grpcClient *grpc.ClientConn, maxRetries uint) ([]*descriptorpb.FileDescriptorProto, error)

FetchAllDescriptors retrieves all file descriptors supported by the server.

Types

type CustomResolver

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

CustomResolver implements the Resolver interface required by protojson. It fetches file descriptors from a gRPC server using the reflection API and registers them in a protoregistry.Files. It also correctly resolves message types by fetching dependencies recursively.

func NewCustomResolver

func NewCustomResolver(files *protoregistry.Files, grpcConn *grpc.ClientConn, ctx context.Context, maxRetries uint) *CustomResolver

NewCustomResolver creates a new instance of CustomResolver.

func (*CustomResolver) FindExtensionByName

func (r *CustomResolver) FindExtensionByName(_ protoreflect.FullName) (protoreflect.ExtensionType, error)

FindExtensionByName is not implemented.

func (*CustomResolver) FindExtensionByNumber

FindExtensionByNumber is not implemented.

func (*CustomResolver) FindMessageByName

func (r *CustomResolver) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error)

FindMessageByName finds a message descriptor by its name.

func (*CustomResolver) FindMessageByURL

func (r *CustomResolver) FindMessageByURL(url string) (protoreflect.MessageType, error)

FindMessageByURL finds a message descriptor by its URL.

func (*CustomResolver) FindMethodDescriptor

func (r *CustomResolver) FindMethodDescriptor(serviceName, methodName string) (protoreflect.MethodDescriptor, error)

Jump to

Keyboard shortcuts

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