ceen/codec/codec.go

21 lines
304 B
Go
Raw Normal View History

2022-06-16 22:19:06 +02:00
package codec
import "errors"
var (
ErrCodecNotRegistered = errors.New("ceen: codec not registered")
Default = JSON
Codecs = map[string]Codec{
JSON.Name(): JSON,
Binary.Name(): Binary,
}
)
type Codec interface {
Name() string
Marshal(any) ([]byte, error)
Unmarshal([]byte, any) error
}