You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I’d like to at a start help to get custom types working in apiv2. Documentation on proto-gen-go code is a little light on for me, so wondering if anyone here can help guide me.
Ideally I’d like to get a working .pb.go file by hand to understand what is needed but even that isn’t as easy as it sounds, as I’m unsure of what’s needed.
Can anyone explain this or point me in the right direction here. Any guidance is appreciated and I can help submit back into apiv2 code if I can get it to work?
The text was updated successfully, but these errors were encountered:
I think the basic idea would be to generate code for 'custom types' that implements protoreflect.Message (actually they should implement protoreflect.ProtoMessage but this just provides a layer of indirection between the custom type and the protobuf reflective type): https://godoc.org/google.golang.org/protobuf/reflect/protoreflect#Message.
For types that implement ProtoMessage the protobuf v2 library will use the Message interface to reflect on the type and push/pull values for marshalling. At that point the code you write to implement Message can handle the mapping between the protobuf type system and any arbitrary Go type.
You can read about the rationale for the protoreflect interfaces here: https://blog.golang.org/protobuf-apiv2. These interfaces are the main content of the v2 API.
Hi, I’d like to at a start help to get custom types working in apiv2. Documentation on proto-gen-go code is a little light on for me, so wondering if anyone here can help guide me.
Ideally I’d like to get a working .pb.go file by hand to understand what is needed but even that isn’t as easy as it sounds, as I’m unsure of what’s needed.
Can anyone explain this or point me in the right direction here. Any guidance is appreciated and I can help submit back into apiv2 code if I can get it to work?
The text was updated successfully, but these errors were encountered: