marshal

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const JSONContentType = "application/json"
View Source
const ProtobufContentType = "application/x-protobuf"

Variables

View Source
var DefaultMarshallerRegistry = map[string]Marshaller{}
View Source
var JSONMarshaller = &JsonMarshaller{}
View Source
var ProtobufMarshaller = &ProtoMarshaller{}

Functions

func RegisterMarshaller

func RegisterMarshaller(marshaller Marshaller)

Types

type JsonMarshaller

type JsonMarshaller struct {
}

func (*JsonMarshaller) ContentType

func (j *JsonMarshaller) ContentType() string

func (*JsonMarshaller) Marshal

func (j *JsonMarshaller) Marshal(v interface{}) ([]byte, error)

func (*JsonMarshaller) Unmarshal

func (j *JsonMarshaller) Unmarshal(data []byte, v interface{}) error

type Marshaller

type Marshaller interface {
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
	ContentType() string
}

type ProtoMarshaller

type ProtoMarshaller struct {
}

func (*ProtoMarshaller) ContentType

func (p *ProtoMarshaller) ContentType() string

func (*ProtoMarshaller) Marshal

func (p *ProtoMarshaller) Marshal(v interface{}) ([]byte, error)

func (*ProtoMarshaller) Unmarshal

func (p *ProtoMarshaller) Unmarshal(data []byte, v interface{}) error

Jump to

Keyboard shortcuts

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