diff --git a/transport/message/encoding.go b/transport/message/encoding.go index 21e5f8c..0edd52b 100644 --- a/transport/message/encoding.go +++ b/transport/message/encoding.go @@ -2,3 +2,12 @@ package message // Encoder is a function that can encode a object to the encoded format. type Encoder func(any) ([]byte, error) + +// Decoder is a function that can decode a format into an object +type Decoder func(any, []byte) error + +// Codec is a type that can has a matching Encoder and Decoder function. +type Codec struct { + Encoder Encoder + Decoder Decoder +}