go-nats: github.com/nats-io/go-nats/encoders/builtin Index | Files

package builtin

import "github.com/nats-io/go-nats/encoders/builtin"

Index

Package Files

default_enc.go gob_enc.go json_enc.go

type DefaultEncoder Uses

type DefaultEncoder struct {
}

DefaultEncoder implementation for EncodedConn. This encoder will leave []byte and string untouched, but will attempt to turn numbers into appropriate strings that can be decoded. It will also propely encoded and decode bools. If will encode a struct, but if you want to properly handle structures you should use JsonEncoder.

func (*DefaultEncoder) Decode Uses

func (je *DefaultEncoder) Decode(subject string, data []byte, vPtr interface{}) error

Decode

func (*DefaultEncoder) Encode Uses

func (je *DefaultEncoder) Encode(subject string, v interface{}) ([]byte, error)

Encode

type GobEncoder Uses

type GobEncoder struct {
}

GobEncoder is a Go specific GOB Encoder implementation for EncodedConn. This encoder will use the builtin encoding/gob to Marshal and Unmarshal most types, including structs.

func (*GobEncoder) Decode Uses

func (ge *GobEncoder) Decode(subject string, data []byte, vPtr interface{}) (err error)

Decode

func (*GobEncoder) Encode Uses

func (ge *GobEncoder) Encode(subject string, v interface{}) ([]byte, error)

Encode

type JsonEncoder Uses

type JsonEncoder struct {
}

JsonEncoder is a JSON Encoder implementation for EncodedConn. This encoder will use the builtin encoding/json to Marshal and Unmarshal most types, including structs.

func (*JsonEncoder) Decode Uses

func (je *JsonEncoder) Decode(subject string, data []byte, vPtr interface{}) (err error)

Decode

func (*JsonEncoder) Encode Uses

func (je *JsonEncoder) Encode(subject string, v interface{}) ([]byte, error)

Encode

Package builtin imports 8 packages (graph) and is imported by 6 packages. Updated 2018-03-17. Refresh now. Tools for package owners.