descriptor

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(pb *plugin.CodeGeneratorRequest) (pkgs map[string][]*File, err error)

Parse parses the given protobuf request into a map of packages (key) and of files information (value).

Types

type File

type File struct {
	Package      string
	Name         string
	Services     []*Service
	Interceptors *Interceptors
}

File represents a protobuf file.

func GetFile

func GetFile(pb *descriptor.FileDescriptorProto) (f *File, err error)

GetFile parses `pb` and builds a `File` object from it. If the file does not define any service nor any interceptor option, it does not return anything.

type Interceptors

type Interceptors struct {
	Indexes []string
}

Interceptors defines interceptors to use.

func GetInterceptors

func GetInterceptors(pb proto.Message, desc *proto.ExtensionDesc) (*Interceptors, error)

GetInterceptors extracts the `Interceptors` extension (described by `desc`) from `pb`.

type Method

type Method struct {
	Package      string
	Service      string
	Method       string
	Stream       bool
	Interceptors *Interceptors
}

Method represents a method from a grpc service.

func GetMethod

func GetMethod(pb *descriptor.MethodDescriptorProto, service, pkg string) (method *Method, err error)

GetMethod parses `pb` and builds from it a `Method` object.

type Service

type Service struct {
	Package      string
	Service      string
	Methods      []*Method
	Interceptors *Interceptors
}

Service represents a grpc service definition from a protobuf file.

func GetService

func GetService(pb *descriptor.ServiceDescriptorProto, pkg string) (s *Service, err error)

GetService parses `pb` and builds a `Service` object from it.

Jump to

Keyboard shortcuts

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