codec

package
v0.0.0-...-f10c188 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCodec

func SetCodec(c Codec)

Sets default codec instance.

Types

type Codec

type Codec interface {
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
}

Codec is the interface that wraps the nrpc Message data encoding method.

var DefaultCodec Codec = &JSONCodec{}

DefaultCodec is the default codec used by nrpc.

type JSONCodec

type JSONCodec struct{}

Wraps std json.

func (*JSONCodec) Marshal

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

Wraps std json.Marshal.

func (*JSONCodec) Unmarshal

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

Wraps std json.Unmarshal

Jump to

Keyboard shortcuts

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