Documentation ¶
Index ¶
- func BufToProto(r io.Reader, msg proto.Message) error
- func BytesToProto(b []byte, msg proto.Message) error
- func BytesToStruct(b []byte) (*structpb.Struct, error)
- func Contains[T proto.Message](collection []T, message T) bool
- func JSONToStruct(val map[string]interface{}) (*structpb.Struct, error)
- func NewStruct() *structpb.Struct
- func ProtoToBuf(w io.Writer, msg proto.Message) error
- func ProtoToBytes(msg proto.Message) ([]byte, error)
- func ProtoToStr(msg proto.Message) string
- func UnmarshalNext(d *json.Decoder, m proto.Message) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BufToProto ¶
BufToProto, unmarshal buffer to proto message instance.
func JSONToStruct ¶
JSONconverts a map decoded from JSON to a protobuf struct. The reason that the map can't be directly converted to a struct using structpb.NewStruct is that when gqlgen decodes a JSON object it calls decoder.UseNumber() on the json.Decoder. As a result, numeric values are decoded as json.Number, instead of float, and structpb.NewStruct doesn't know how to handle that.
func ProtoToBuf ¶
ProtoToBuf, marshal proto message to buffer.
func ProtoToBytes ¶
ProtoToBuf, marshal proto message to buffer.
func ProtoToStr ¶
ProtoToStr, marshal proto message to string representation.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.