message

package
v0.0.0-...-d04bc5a Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProtoMarshal   = protojson.MarshalOptions{UseProtoNames: true, EmitUnpopulated: true}.Marshal
	ProtoUnmarshal = protojson.UnmarshalOptions{}.Unmarshal
)
View Source
var ContentType2EncodingType = map[string]ContentEncodingType{
	"application/json":       EncodingTypeJson,
	"application/x-protobuf": EncodingTypeProtobuf,
}
View Source
var EncodingType2ContentType = map[ContentEncodingType]string{
	EncodingTypeJson:     "application/json",
	EncodingTypeProtobuf: "application/x-protobuf",
}

Functions

func SerializeTo

func SerializeTo(response proto.Message, encodingType ContentEncodingType) (content string, err error)

Types

type ContentEncodingType

type ContentEncodingType int
const (
	EncodingTypeUnknown ContentEncodingType = iota + 1
	EncodingTypeJson
	EncodingTypeProtobuf
)

func DeserializeFrom

func DeserializeFrom(in io.ReadCloser, request proto.Message, contentType string) (ContentEncodingType, error)

Jump to

Keyboard shortcuts

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