[#40] types: Generate StableMarshaler methods for refs

* Add plugin option for protogen in Makefile
* Fix the generator for the plugin in util/protogen
* Fix marshaler.go for refs

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
Airat Arifullin 2023-06-13 01:33:53 +03:00
parent 8266b31092
commit f0642d7f13
8 changed files with 343 additions and 191 deletions

View file

@ -14,7 +14,7 @@ import (
)
type (
stableMarshaller interface {
StableMarshaller interface {
StableMarshal([]byte) []byte
StableSize() int
}
@ -302,7 +302,7 @@ func NestedStructurePrefix(field int64) (prefix uint64, ln int) {
return prefix, VarUIntSize(prefix)
}
func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) int {
func NestedStructureMarshal(field int64, buf []byte, v StableMarshaller) int {
if v == nil || reflect.ValueOf(v).IsNil() {
return 0
}
@ -317,7 +317,7 @@ func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) int {
return offset + n
}
func NestedStructureSize(field int64, v stableMarshaller) (size int) {
func NestedStructureSize(field int64, v StableMarshaller) (size int) {
if v == nil || reflect.ValueOf(v).IsNil() {
return 0
}

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.9
// protoc-gen-go v1.30.0
// protoc v3.12.4
// source: util/proto/test/test.proto
package test