wire

package
v0.0.0-...-7546d5c Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JsonWire

type JsonWire struct{}

JsonWire is a Marshaler which marshals/unmarshals into/from serialize json bytes

func (*JsonWire) ContentType

func (*JsonWire) ContentType() string

ContentType always returns "application/json".

func (*JsonWire) Marshal

func (j *JsonWire) Marshal(any interface{}) ([]byte, error)

Marshal marshals "any" into JSON

func (*JsonWire) Unmarshal

func (j *JsonWire) Unmarshal(data []byte, any interface{}) error

Unmarshal unmarshals JSON data into "any".

type ProtoWire

type ProtoWire struct{}

ProtoWire is a Marshaler which marshals/unmarshals into/from serialize proto bytes

func (*ProtoWire) ContentType

func (*ProtoWire) ContentType() string

ContentType always returns "application/proto".

func (*ProtoWire) Marshal

func (*ProtoWire) Marshal(value interface{}) ([]byte, error)

Marshal marshals "value" into Proto

func (*ProtoWire) Unmarshal

func (*ProtoWire) Unmarshal(data []byte, value interface{}) error

Unmarshal unmarshals proto "data" into "value"

type WireMarshaler

type WireMarshaler interface {

	// Marshal marshals "any" into byte sequence.
	Marshal(any interface{}) ([]byte, error)

	// Unmarshal unmarshals "data" into "any".
	// "any" must be a pointer value.
	Unmarshal(data []byte, any interface{}) error

	// ContentType returns the Content-Type which this marshaler is responsible for.
	ContentType() string
}

WireMarshaler defines a conversion between byte sequence and raccoon request payloads.

Jump to

Keyboard shortcuts

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