1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-17 04:30:03 +02:00

transport/message/encoding.go: Add Decoder and Codec

This commit is contained in:
Henrik Hautakoski 2023-02-10 16:54:31 +01:00
parent 027ba0b1ff
commit 315d7e19c9

View file

@ -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
}