envelope

package
v0.0.0-...-7f00d58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeHeaderName        = "type"
	MessageTypeHeaderName = "mtyp"

	JsonType = "json"
	GobType  = "gob"
	XmlType  = "xml"
)

Variables

View Source
var (
	ErrMessageTooSmall    = errors.New("message is too small")
	ErrInvalidMessageType = errors.New("invalid message type")
)

Functions

This section is empty.

Types

type Codec

type Codec struct {
	// contains filtered or unexported fields
}

func NewCodec

func NewCodec() *Codec

func (*Codec) AddDecoder

func (c *Codec) AddDecoder(contentType string, decoder DecoderFactory)

func (*Codec) AddEncoder

func (c *Codec) AddEncoder(contentType string, encoder EncoderFactory)

func (*Codec) Decoder

func (c *Codec) Decoder(contentType string, r io.Reader) Decoder

func (*Codec) Encoder

func (c *Codec) Encoder(contentType string, w io.Writer) Encoder

type Decoder

type Decoder interface {
	Decode(v interface{}) error
}

type DecoderFactory

type DecoderFactory interface {
	NewDecoder(r io.Reader) Decoder
}

type Encoder

type Encoder interface {
	Encode(v interface{}) error
}

type EncoderFactory

type EncoderFactory interface {
	NewEncoder(w io.Writer) Encoder
}

type Envelope

type Envelope struct {
	// contains filtered or unexported fields
}

func NewEnvelope

func NewEnvelope(header *Header, body interface{}) *Envelope

func (*Envelope) Body

func (e *Envelope) Body() interface{}

func (*Envelope) Header

func (e *Envelope) Header() *Header

type Factory

type Factory interface {
	EncoderFactory
	DecoderFactory
}

type Flate

type Flate struct {
	// contains filtered or unexported fields
}

func NewFlate

func NewFlate(dict []byte, decorated Factory) *Flate

func (*Flate) NewDecoder

func (f *Flate) NewDecoder(r io.Reader) Decoder

func (*Flate) NewEncoder

func (f *Flate) NewEncoder(w io.Writer) Encoder

type Gob

type Gob struct {
}

func NewGob

func NewGob() *Gob

func (*Gob) NewDecoder

func (g *Gob) NewDecoder(r io.Reader) Decoder

func (*Gob) NewEncoder

func (g *Gob) NewEncoder(w io.Writer) Encoder
type Header struct {
	// contains filtered or unexported fields
}

func NewHeader

func NewHeader() *Header

func ParseHeaderFrom

func ParseHeaderFrom(r io.Reader) (*Header, error)

func (*Header) Delete

func (h *Header) Delete(key string)

func (*Header) Get

func (h *Header) Get(key string) string

func (*Header) Len

func (h *Header) Len() int

func (*Header) Set

func (h *Header) Set(key, value string) error

func (*Header) WriteTo

func (h *Header) WriteTo(w io.Writer) (int64, error)

type Json

type Json struct {
}

func NewJson

func NewJson() *Json

func (*Json) NewDecoder

func (j *Json) NewDecoder(r io.Reader) Decoder

func (*Json) NewEncoder

func (j *Json) NewEncoder(w io.Writer) Encoder

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Create

func (mtr *Registry) Create(typeName string) interface{}

func (*Registry) MessageType

func (mtr *Registry) MessageType(v interface{}) string

func (*Registry) Register

func (mtr *Registry) Register(typeName string, typ reflect.Type)

type Serializer

type Serializer struct {
	// contains filtered or unexported fields
}

func NewSerializer

func NewSerializer(registry *Registry, codec *Codec, defaultType string) *Serializer

func (*Serializer) Parse

func (s *Serializer) Parse(msg []byte) (*Envelope, error)

func (*Serializer) Serialize

func (s *Serializer) Serialize(e *Envelope) ([]byte, error)

type Xml

type Xml struct {
}

func NewXml

func NewXml() *Xml

func (*Xml) NewDecoder

func (x *Xml) NewDecoder(r io.Reader) Decoder

func (*Xml) NewEncoder

func (x *Xml) NewEncoder(w io.Writer) Encoder

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL