extract

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package extract is used to extract elements from FileDescriptorSets created from internal/protoc, for use in json-to-binary and back conversion, and for use for gRPC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	*descriptor.FieldDescriptorProto

	FullyQualifiedPath  string
	DescriptorProto     *descriptor.DescriptorProto
	FileDescriptorProto *descriptor.FileDescriptorProto
	FileDescriptorSet   *descriptor.FileDescriptorSet
}

Field is an extracted field.

type Getter

type Getter interface {
	// Get the field that matches the path.
	// Return non-nil value, or error otherwise including if nothing found.
	GetField(fileDescriptorSets []*descriptor.FileDescriptorSet, path string) (*Field, error)
	// Get the message that matches the path.
	// Return non-nil value, or error otherwise including if nothing found.
	GetMessage(fileDescriptorSets []*descriptor.FileDescriptorSet, path string) (*Message, error)
	// Get the service that matches the path.
	// Return non-nil value, or error otherwise including if nothing found.
	GetService(fileDescriptorSets []*descriptor.FileDescriptorSet, path string) (*Service, error)
}

Getter extracts elements.

Paths can begin with ".". The first FileDescriptorSet with a match will be returned.

func NewGetter

func NewGetter(options ...GetterOption) Getter

NewGetter returns a new Getter.

type GetterOption

type GetterOption func(*getter)

GetterOption is an option for a new Getter.

func GetterWithLogger

func GetterWithLogger(logger *zap.Logger) GetterOption

GetterWithLogger returns a GetterOption that uses the given logger.

The default is to use zap.NewNop().

type Message

type Message struct {
	*descriptor.DescriptorProto

	FullyQualifiedPath  string
	FileDescriptorProto *descriptor.FileDescriptorProto
	FileDescriptorSet   *descriptor.FileDescriptorSet
}

Message is an extracted message.

type Service

type Service struct {
	*descriptor.ServiceDescriptorProto

	FullyQualifiedPath  string
	FileDescriptorProto *descriptor.FileDescriptorProto
	FileDescriptorSet   *descriptor.FileDescriptorSet
}

Service is an extracted service.

Jump to

Keyboard shortcuts

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