Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNilRegistry = errors.New("encoding: registry is nil") ErrNilCodec = errors.New("encoding: codec is nil") ErrEmptyContentType = errors.New("encoding: content type is empty") ErrCodecNotFound = errors.New("encoding: codec not found") ErrRegistryNotFound = errors.New("encoding: registry not found in context") )
Functions ¶
Types ¶
type CodecRegistrar ¶
Registry stores codecs by content type.
type Decoder ¶
type Decoder interface {
Decode(data []byte) (runtime.Value, error)
DecodeWith() DecoderConfigurer
}
Decoder converts bytes into runtime values.
type DecoderConfigurer ¶
type DecoderConfigurer interface {
PreHook(PreDecoderHook) DecoderConfigurer
PostHook(PostDecoderHook) DecoderConfigurer
Decoder() Decoder
}
type Encoder ¶
type Encoder interface {
Encode(value runtime.Value) ([]byte, error)
EncodeWith() EncoderConfigurer
}
Encoder converts runtime values into bytes.
type EncoderConfigurer ¶
type EncoderConfigurer interface {
PreHook(PreEncoderHook) EncoderConfigurer
PostHook(PostEncoderHook) EncoderConfigurer
Encoder() Encoder
}
type PostDecoderHook ¶
type PreDecoderHook ¶
type PreEncoderHook ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores codecs by content type.
func NewEmptyRegistry ¶
func NewEmptyRegistry() *Registry
NewEmptyRegistry creates a registry without predefined codecs.
func NewRegistry ¶
NewRegistry creates a registry seeded with the provided codecs.
func RegistryFrom ¶
RegistryFrom gets registry from context.
Click to show internal directories.
Click to hide internal directories.