Documentation ¶
Overview ¶
Package marshaler provides marshalers for converting values to and from their binary representations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // String marshals and unmarshals the built-in string type by performing a // Go type-conversion. String = New( func(v string) ([]byte, error) { return []byte(v), nil }, func(data []byte) (string, error) { return string(data), nil }, ) // Bool marshals and unmarshals the built-in bool type. Bool = New( func(v bool) ([]byte, error) { if v { return []byte{1}, nil } return nil, nil }, func(data []byte) (bool, error) { return len(data) > 0, nil }, ) )
Functions ¶
This section is empty.
Types ¶
type Marshaler ¶
Marshaler is an interface for types that can marshal and unmarshal values of type T.
func New ¶
New returns a new Marshaler that marshals and unmarshals values of type T using the given functions.
Click to show internal directories.
Click to hide internal directories.