...

Package json

import "github.com/gonitro/nitro/app/codec/json"
Overview
Index

Overview ▾

Package json provides a json codec

func NewCodec

func NewCodec(c io.ReadWriteCloser) codec.Codec

type Codec

type Codec struct {
    Conn    io.ReadWriteCloser
    Encoder *json.Encoder
    Decoder *json.Decoder
}

func (*Codec) Close

func (c *Codec) Close() error

func (*Codec) ReadBody

func (c *Codec) ReadBody(b interface{}) error

func (*Codec) ReadHeader

func (c *Codec) ReadHeader(m *codec.Message, t codec.MessageType) error

func (*Codec) String

func (c *Codec) String() string

func (*Codec) Write

func (c *Codec) Write(m *codec.Message, b interface{}) error

type Marshaler

type Marshaler struct{}

func (Marshaler) Marshal

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

func (Marshaler) String

func (j Marshaler) String() string

func (Marshaler) Unmarshal

func (j Marshaler) Unmarshal(d []byte, v interface{}) error