Documentation ¶
Index ¶
- func Marshal(v interface{}, options ...MarshalOption) ([]byte, error)
- func Unmarshal(data []byte, v interface{}, options ...UnmarshalOption) error
- type InvalidUnmarshalError
- type MarshalOption
- type Marshaler
- type MarshalerError
- type Number
- type Option
- type SyntaxError
- type UnmarshalOption
- type UnmarshalTypeError
- type Unmarshaler
- type UnsupportedTypeError
- type UnsupportedValueError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
func Marshal(v interface{}, options ...MarshalOption) ([]byte, error)
func Unmarshal ¶
func Unmarshal(data []byte, v interface{}, options ...UnmarshalOption) error
Types ¶
type InvalidUnmarshalError ¶
An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. (The argument to Unmarshal must be a non-nil pointer.)
func (*InvalidUnmarshalError) Error ¶
func (e *InvalidUnmarshalError) Error() string
type MarshalOption ¶
type MarshalOption interface {
// contains filtered or unexported methods
}
type Marshaler ¶
Marshaler is the interface implemented by types that can marshal themselves into valid UBJSON.
type MarshalerError ¶
A MarshalerError represents an error from calling a MarshalUBJSON or MarshalText method.
func (*MarshalerError) Error ¶
func (e *MarshalerError) Error() string
func (*MarshalerError) Unwrap ¶
func (e *MarshalerError) Unwrap() error
type SyntaxError ¶
type SyntaxError struct { Offset int64 // error occurred after reading Offset bytes // contains filtered or unexported fields }
A SyntaxError is a description of a UBJSON syntax error.
func (*SyntaxError) Error ¶
func (e *SyntaxError) Error() string
type UnmarshalOption ¶
type UnmarshalOption interface {
// contains filtered or unexported methods
}
type UnmarshalTypeError ¶
type UnmarshalTypeError struct { Value string // description of UBJSON value - "bool", "array", "number -5" Type reflect.Type // type of Go value it could not be assigned to Offset int64 // error occurred after reading Offset bytes Struct string // name of the struct type containing the field Field string // the full path from root node to the field }
An UnmarshalTypeError describes a UBJSON value that was not appropriate for a value of a specific Go type.
func (*UnmarshalTypeError) Error ¶
func (e *UnmarshalTypeError) Error() string
type Unmarshaler ¶
Unmarshaler is the interface implemented by types that can unmarshal a UBJSON description of themselves. The input can be assumed to be a valid encoding of a UBJSON value. UnmarshalUBJSON must copy the UBJSON data if it wishes to retain the data after returning.
By convention, to approximate the behavior of Unmarshal itself, Unmarshalers implement UnmarshalUBJSON([]byte("null")) as a no-op.
type UnsupportedTypeError ¶
An UnsupportedTypeError is returned by Marshal when attempting to encode an unsupported value type.
func (*UnsupportedTypeError) Error ¶
func (e *UnsupportedTypeError) Error() string
type UnsupportedValueError ¶
func (*UnsupportedValueError) Error ¶
func (e *UnsupportedValueError) Error() string