mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-03 11:53:41 +02:00
transport/message/encoding.go: Add Decoder and Codec
This commit is contained in:
parent
027ba0b1ff
commit
315d7e19c9
1 changed files with 9 additions and 0 deletions
|
|
@ -2,3 +2,12 @@ package message
|
||||||
|
|
||||||
// Encoder is a function that can encode a object to the encoded format.
|
// Encoder is a function that can encode a object to the encoded format.
|
||||||
type Encoder func(any) ([]byte, error)
|
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
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue