protoc-gen-oneofmapper

command module
v0.0.0-...-7a5236a Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 9 Imported by: 0

README

OneOfMapper

protoc plugin to provide a map of messages in each oneof of a proto message as a list of typed constants enum

Purpose

For a sample message:


message SampleMessage {
  oneof test_message {
    string name = 4;
    SubMessage sub_message = 9;
  }
}

generate a Go type and constants:

type OneOfTestMessage string

const (
	TestMessage_Name       OneOfTestMessage = "Name"
	TestMessage_SubMessage OneOfTestMessage = "SubMessage"
)

Usage

go get github.com/alexykot/protoc-gen-oneofmapper
go install github.com/alexykot/protoc-gen-oneofmapper

protoc  -I ./proto/ myfile.proto --go_out=plugins=grpc:. --oneofmapper_out=.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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