package builtin
import "github.com/nats-io/nats.go/encoders/builtin"
Index ¶
- type DefaultEncoder
- func (je *DefaultEncoder) Decode(subject string, data []byte, vPtr interface{}) error
- func (je *DefaultEncoder) Encode(subject string, v interface{}) ([]byte, error)
- type GobEncoder
- func (ge *GobEncoder) Decode(subject string, data []byte, vPtr interface{}) (err error)
- func (ge *GobEncoder) Encode(subject string, v interface{}) ([]byte, error)
- type JsonEncoder
Types ¶
type DefaultEncoder ¶
type DefaultEncoder struct { }
A Default Encoder 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 ¶
func (je *DefaultEncoder) Decode(subject string, data []byte, vPtr interface{}) error
func (*DefaultEncoder) Encode ¶
func (je *DefaultEncoder) Encode(subject string, v interface{}) ([]byte, error)
type GobEncoder ¶
type GobEncoder struct { }
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 ¶
func (ge *GobEncoder) Decode(subject string, data []byte, vPtr interface{}) (err error)
func (*GobEncoder) Encode ¶
func (ge *GobEncoder) Encode(subject string, v interface{}) ([]byte, error)
type JsonEncoder ¶
type JsonEncoder struct { }
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 ¶
func (je *JsonEncoder) Decode(subject string, data []byte, vPtr interface{}) (err error)
func (*JsonEncoder) Encode ¶
func (je *JsonEncoder) Encode(subject string, v interface{}) ([]byte, error)
Source Files ¶
default_enc.go gob_enc.go json_enc.go
- Version
- v1.1.2
- Published
- Sep 18, 2015
- Platform
- darwin/amd64
- Imports
- 8 packages
- Last checked
- 11 minutes ago –
Tools for package owners.