Documentation ¶
Overview ¶
Refmt is a serialization and object-mapping library.
Look to the README on github for more high-level information.
This top-level package exposes simple helper methods for most common operations. You can also compose custom marshallers/unmarshallers and serializer/deserializers by constructing a `refmt.TokenPump` with components from the packages beneath this one. For example, the `refmt.JsonEncode` helper method can be replicated by combining an `obj.Marshaller` with a `json.Encoder`.
Index ¶
- func Clone(src, dst interface{}) error
- func CloneAtlased(src, dst interface{}, atl atlas.Atlas) error
- func Marshal(opts EncodeOptions, v interface{}) ([]byte, error)
- func MarshalAtlased(opts EncodeOptions, v interface{}, atl atlas.Atlas) ([]byte, error)
- func MustClone(src, dst interface{})
- func MustCloneAtlased(src, dst interface{}, atl atlas.Atlas)
- func Unmarshal(opts DecodeOptions, data []byte, v interface{}) error
- func UnmarshalAtlased(opts DecodeOptions, data []byte, v interface{}, atl atlas.Atlas) error
- type Cloner
- type DecodeOptions
- type EncodeOptions
- type Marshaller
- type Unmarshaller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneAtlased ¶
func Marshal ¶
func Marshal(opts EncodeOptions, v interface{}) ([]byte, error)
func MarshalAtlased ¶
func MarshalAtlased(opts EncodeOptions, v interface{}, atl atlas.Atlas) ([]byte, error)
func MustCloneAtlased ¶
func Unmarshal ¶
func Unmarshal(opts DecodeOptions, data []byte, v interface{}) error
func UnmarshalAtlased ¶
func UnmarshalAtlased(opts DecodeOptions, data []byte, v interface{}, atl atlas.Atlas) error
Types ¶
type DecodeOptions ¶
type DecodeOptions interface {
IsDecodeOptions() // marker method.
}
type EncodeOptions ¶
type EncodeOptions interface {
IsEncodeOptions() // marker method.
}
type Marshaller ¶
type Marshaller interface {
Marshal(v interface{}) error
}
func NewMarshaller ¶
func NewMarshaller(opts EncodeOptions, wr io.Writer) Marshaller
func NewMarshallerAtlased ¶
func NewMarshallerAtlased(opts EncodeOptions, wr io.Writer, atl atlas.Atlas) Marshaller
type Unmarshaller ¶
type Unmarshaller interface {
Unmarshal(v interface{}) error
}
func NewUnmarshaller ¶
func NewUnmarshaller(opts DecodeOptions, r io.Reader) Unmarshaller
func NewUnmarshallerAtlased ¶
func NewUnmarshallerAtlased(opts DecodeOptions, r io.Reader, atl atlas.Atlas) Unmarshaller
Directories ¶
Path | Synopsis |
---|---|
Package implementing the CBOR -- Concise Binary Object Notation -- http://cbor.io/ -- spec.
|
Package implementing the CBOR -- Concise Binary Object Notation -- http://cbor.io/ -- spec. |
Package implementing the JSON -- http://json.org/ -- spec.
|
Package implementing the JSON -- http://json.org/ -- spec. |
The `obj` package defines Marshaller and Unmarshaller types, which can be used to convert in-memory values to token streams, and token streams to unpack in-memory values.
|
The `obj` package defines Marshaller and Unmarshaller types, which can be used to convert in-memory values to token streams, and token streams to unpack in-memory values. |
atlas
Atlas types are used to define how to map Go values into refmt token streams.
|
Atlas types are used to define how to map Go values into refmt token streams. |
The `shared` package defines helper types and functions used internally by all the other refmt packages; it is not user-facing.
|
The `shared` package defines helper types and functions used internally by all the other refmt packages; it is not user-facing. |
Package containing Token struct and TokenType info.
|
Package containing Token struct and TokenType info. |
Click to show internal directories.
Click to hide internal directories.