codec

package
v0.0.0-...-a2ce4e4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultProtoMarshal = &runtime.JSONPb{
		MarshalOptions: protojson.MarshalOptions{
			EmitUnpopulated: true,
			UseEnumNumbers:  false,
			UseProtoNames:   true,
		},
		UnmarshalOptions: protojson.UnmarshalOptions{
			DiscardUnknown: true,
		},
	}
)

Functions

func ProtobufParamsDecoder

func ProtobufParamsDecoder(raw json.RawMessage, params interface{}) error

func ProtobufReplyEncoder

func ProtobufReplyEncoder(reply interface{}) ([]byte, error)

func StdParamsDecoder

func StdParamsDecoder(raw json.RawMessage, params interface{}) error

func StdReplyEncoder

func StdReplyEncoder(reply interface{}) ([]byte, error)

Types

type CodecType

type CodecType int
const (
	JsonCodec     CodecType = 0
	ProtobufCodec CodecType = 1
)

type ParamDecoder

type ParamDecoder func(raw json.RawMessage, params interface{}) error

func GetParamDecoder

func GetParamDecoder(c CodecType) ParamDecoder

type ReplyEncoder

type ReplyEncoder func(reply interface{}) ([]byte, error)

func GetReplyEncoder

func GetReplyEncoder(c CodecType) ReplyEncoder

Jump to

Keyboard shortcuts

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