package encoding

import "github.com/mesos/mesos-go/api/v1/lib/encoding"

Index

Types

type Codec

type Codec struct {
	Name       string
	Type       MediaType
	NewEncoder func(Sink) Encoder
	NewDecoder func(Source) Decoder
}

A Codec composes encoding and decoding of a serialization format.

func (*Codec) String

func (c *Codec) String() string

String implements the fmt.Stringer interface.

type Decoder

type Decoder interface {
	Decode(Unmarshaler) error
}

A Decoder decodes a given Unmarshaler or returns an error in case of failure.

type DecoderFunc

type DecoderFunc func(Unmarshaler) error

DecoderFunc is the functional adapter for Decoder

func (DecoderFunc) Decode

func (f DecoderFunc) Decode(u Unmarshaler) error

Decode implements the Decoder interface

type Encoder

type Encoder interface {
	Encode(Marshaler) error
}

An Encoder encodes a given Marshaler or returns an error in case of failure.

type EncoderFunc

type EncoderFunc func(Marshaler) error

EncoderFunc is the functional adapter for Encoder

func (EncoderFunc) Encode

func (f EncoderFunc) Encode(m Marshaler) error

Encode implements the Encoder interface

type Marshaler

type Marshaler interface {
	pb.Marshaler
	json.Marshaler
}

Marshaler composes the supported marshaling formats.

type MediaType

type MediaType string

func (MediaType) ContentType

func (m MediaType) ContentType() string

ContentType returns the HTTP Content-Type associated with the MediaType

type Sink

type Sink func() framing.Writer

func SinkWriter

func SinkWriter(w io.Writer) Sink

SinkWriter returns a Sink that sends a frame to an io.Writer with no decoration.

type SinkFactory

type SinkFactory interface {
	NewSink(w io.Writer) Sink
}

type SinkFactoryFunc

type SinkFactoryFunc func(w io.Writer) Sink

func (SinkFactoryFunc) NewSink

func (f SinkFactoryFunc) NewSink(w io.Writer) Sink

type Source

type Source func() framing.Reader

func SourceReader

func SourceReader(r io.Reader) Source

SourceReader returns a Source that buffers all input from the given io.Reader and returns the contents in a single frame.

type SourceFactory

type SourceFactory interface {
	NewSource(r io.Reader) Source
}

type SourceFactoryFunc

type SourceFactoryFunc func(r io.Reader) Source

func (SourceFactoryFunc) NewSource

func (f SourceFactoryFunc) NewSource(r io.Reader) Source

type Unmarshaler

type Unmarshaler interface {
	pb.Unmarshaler
	json.Unmarshaler
}

Unmarshaler composes the supporter unmarshaling formats.

Source Files

types.go

Directories

PathSynopsis
api/v1/lib/encoding/codecs
api/v1/lib/encoding/framing
api/v1/lib/encoding/json
api/v1/lib/encoding/protoPackage proto implements protobuf utilities such as functional options to construct complex structs and encoders and decoders composable with io.ReadWriters.
Version
v0.0.11 (latest)
Published
May 15, 2020
Platform
linux/amd64
Imports
4 packages
Last checked
1 hour ago

Tools for package owners.