Categorygithub.com/emicklei/protobuf2map
modulepackage
1.1.0
Repository: https://github.com/emicklei/protobuf2map.git
Documentation: pkg.go.dev

# README

protobuf2map

protobuf2map can decode a ProtocolBuffer marshaled message into a map[string]interface{} using its .proto definition.

This package was created to transform such messages directly to JSON without using the generated (Go) code to do the unmarshaling and marshaling. It can be used to inspect messages for quick view and debugging. Do not use this if performance is of importance.

package main

import (
		pd "github.com/emicklei/protobuf2map"
)

func main() {
	defs := pd.NewDefinitions()
	_ = defs.ReadFile("your.proto")
	protoBytes := []byte{} // your marshalled Protobuf message
	dec := pd.NewDecoder(defs, proto.NewBuffer(protoBytes))
	result, _ := dec.Decode("yours", "YourMessage")
	log.Printf("%#v",result)
}

how to compile the test

protoc --go_out=. *.proto

# Functions

NewDecoder is the thing.
No description provided by the author

# Variables

ErrEndOfMessage signals the decoder that a full message has been decoded.

# Structs

No description provided by the author