protoc-gen-gofullmethods

command module
v0.0.0-...-96391a1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: MIT Imports: 14 Imported by: 0

README

protoc-gen-gofullmethods

This is a protoc go plugin to generate constants for all gRPC server methods.

Use case

A use case could be to add some logic for a certain rpc method. For example, adding a condition for a certain rpc method in a gRPC server middleware. See here an example on line 33: example/server/server.go

Usage

Install
$ go get -u github.com/go-tooling/protoc-gen-gofullmethods
$ go install github.com/go-tooling/protoc-gen-gofullmethods
Generate

Include the --gofullmethods_out= flag to generate the .fullmethods.pb.go file.

$ protoc -I example service.proto --go_out=plugins=grpc:example --gofullmethods_out=example

Example

See here an example of the generated file: service.fullmethods.pb.go

package example

const (
	Greeter_SayHello = "/helloworld.Greeter/SayHello"
	Greeter_SayBye   = "/helloworld.Greeter/SayBye"
)

var (
	FullMethods = []string{
		Greeter_SayHello,
		Greeter_SayBye,
	}
)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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