MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB / AddExtension

Method AddExtension

lib/encoding/messagepack.go:111–118  ·  view source on GitHub ↗

AddExtension method allows for setting custom encoders/decoders for specific reflect.Types.

(
	t reflect.Type,
	id byte,
	encoder func(reflect.Value) ([]byte, error),
	decoder func(reflect.Value, []byte) error)

Source from the content-addressed store, hash-verified

109
110// AddExtension method allows for setting custom encoders/decoders for specific reflect.Types.
111func (m *MessagePackCodec) AddExtension(
112 t reflect.Type,
113 id byte,
114 encoder func(reflect.Value) ([]byte, error),
115 decoder func(reflect.Value, []byte) error) error {
116
117 return m.MsgPack.AddExt(t, id, encoder, decoder)
118}
119
120// EncodeMessagePack function encodes a given object into MessagePack format.
121func EncodeMessagePack(msg interface{}) ([]byte, error) {

Callers 1

TestAddExtensionFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestAddExtensionFunction · 0.64