reflection

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message interface {
	// MarshalJSON marshals the Message into JSON
	MarshalJSON() ([]byte, error)
	// UnmarshalJSON unmarshals JSON into a Message
	UnmarshalJSON(b []byte) error
	// ConvertFrom converts a raw protobuf message into a Message
	ConvertFrom(target proto.Message) error
	// AsProtoreflectMessage returns the underlying protoreflect message
	AsProtoreflectMessage() *dynamic.Message
}

type MessageDescriptor

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

MessageDescriptor represents a message type

func (*MessageDescriptor) NewMessage

func (m *MessageDescriptor) NewMessage() *messageImpl

NewMessage creates a new message from the message descriptor

type MethodDescriptor

type MethodDescriptor struct {
	*desc.MethodDescriptor
}

MethodDescriptor represents a method type

func (*MethodDescriptor) AsProtoreflectDescriptor

func (m *MethodDescriptor) AsProtoreflectDescriptor() *desc.MethodDescriptor

AsProtoreflectDescriptor returns the underlying protoreflect method descriptor

func (*MethodDescriptor) GetInputType

func (m *MethodDescriptor) GetInputType() *MessageDescriptor

GetInputType gets the MessageDescriptor for the method input type

func (*MethodDescriptor) GetOutputType

func (m *MethodDescriptor) GetOutputType() *MessageDescriptor

GetOutputType gets the MessageDescriptor for the method output type

type MethodInvocation

type MethodInvocation struct {
	*MethodDescriptor
	Message
}

MethodInvocation contains a method and a message used to invoke an RPC

type Reflector

type Reflector interface {
	CreateInvocation(ctx context.Context, serviceName, methodName string, input []byte) (*MethodInvocation, error)
}

Reflector performs reflection on the gRPC service to obtain the method type

func NewReflector

func NewReflector(rc grpcreflectClient) Reflector

NewReflector creates a new Reflector from the reflection client

type ServiceDescriptor

type ServiceDescriptor struct {
	*desc.ServiceDescriptor
}

ServiceDescriptor represents a service type

func ServiceDescriptorFromFileDescriptor

func ServiceDescriptorFromFileDescriptor(fd *desc.FileDescriptor, service string) *ServiceDescriptor

ServiceDescriptorFromFileDescriptor finds the service descriptor from a file descriptor This can be useful in tests that don't connect to a real server

func (*ServiceDescriptor) FindMethodByName

func (s *ServiceDescriptor) FindMethodByName(name string) (*MethodDescriptor, error)

FindMethodByName finds the method descriptor by name from the service descriptor

Jump to

Keyboard shortcuts

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