Skip to content

A protoc plugin that generates Go code for accessing MethodOptions on protobuf service methods.

License

Notifications You must be signed in to change notification settings

taylow/protoc-gen-go-methodoptions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protoc-gen-go-methodoptions

Table of Contents

About

This is a protoc plugin that generates Go code for the google.protobuf.MethodOptions message type. This allows you to write your own custom options for your gRPC services, and provides a few ways to access them (constants, request methods, and service methods).

Getting Started

Prerequisites

What things you need to install the software and how to install them.

Give examples

Installing

go install github.com/taylow/protoc-gen-go-methodoptions@latest

Generate

protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative --go-methodoptions_out=. --go-methodoptions_opt=paths=source_relative example/service.proto

Usage

This system was developed while working at Comnoco and is used to allow us to add custom options to our gRPC services. We use this to define our authorisation roles at the proto level, allowing both the frontend and backend to use the same authorisation rules. A full example of this can be found in the example directory.

About

A protoc plugin that generates Go code for accessing MethodOptions on protobuf service methods.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published