Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var HTTPRequestMarshaler = NewMarshaler(marshalHTTPRequest, unmarshalHTTPRequest, nil)
View Source
var HTTPResponseMarshaler = NewMarshaler(
marshalHTTPResponse,
unmarshalHTTPResponse,
unmarshalHTTPResponseTo,
)
View Source
var JSON = NewMarshaler(json.Marshal, nil, json.Unmarshal)
View Source
var Null = NewMarshaler( func(value interface{}) (b []byte, err error) { if value, ok := value.([]byte); ok { b = value } else { err = errors.New("expected a byte slice") } return }, func(b []byte) (interface{}, error) { return b, nil }, func(b []byte, target interface{}) (err error) { if target, ok := target.(*[]byte); ok { *target = b } else { err = errors.New("expect a byte slice pointer") } return }, )
View Source
var XML = NewMarshaler(xml.Marshal, nil, xml.Unmarshal)
Functions ¶
This section is empty.
Types ¶
type MarshalFunc ¶
type Marshaler ¶
type Marshaler interface { Marshal(value interface{}) (b []byte, err error) Unmarshal(b []byte) (result interface{}, err error) UnmarshalTo(b []byte, target interface{}) (err error) }
func NewMarshaler ¶
func NewMarshaler(marshalFunc MarshalFunc, unmarshalFunc UnmarshalFunc, unmarshalToFunc UnmarshalToFunc) Marshaler
type UnmarshalFunc ¶
type UnmarshalToFunc ¶
Click to show internal directories.
Click to hide internal directories.