encoding

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 4 Imported by: 62

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 added in v0.0.4

type MediaType string

func (MediaType) ContentType added in v0.0.4

func (m MediaType) ContentType() string

ContentType returns the HTTP Content-Type associated with the MediaType

type Sink added in v0.0.4

type Sink func() framing.Writer

func SinkWriter added in v0.0.4

func SinkWriter(w io.Writer) Sink

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

type SinkFactory added in v0.0.4

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

type SinkFactoryFunc added in v0.0.4

type SinkFactoryFunc func(w io.Writer) Sink

func (SinkFactoryFunc) NewSink added in v0.0.4

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

type Source added in v0.0.4

type Source func() framing.Reader

func SourceReader added in v0.0.4

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 added in v0.0.4

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

type SourceFactoryFunc added in v0.0.4

type SourceFactoryFunc func(r io.Reader) Source

func (SourceFactoryFunc) NewSource added in v0.0.4

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

type Unmarshaler

type Unmarshaler interface {
	pb.Unmarshaler
	json.Unmarshaler
}

Unmarshaler composes the supporter unmarshaling formats.

Directories

Path Synopsis
Package proto implements protobuf utilities such as functional options to construct complex structs and encoders and decoders composable with io.ReadWriters.
Package proto implements protobuf utilities such as functional options to construct complex structs and encoders and decoders composable with io.ReadWriters.

Jump to

Keyboard shortcuts

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