Documentation ¶
Index ¶
- Constants
- func Canonicalize(in []byte) ([]byte, error)
- func EnsureMaxDepth(unsafeRawReader *bufio.Reader, maxDepth int) error
- func EnsureMaxDepthBytesDefault(unsafeRaw []byte) error
- func EnsureMaxDepthDefault(unsafeRawReader *bufio.Reader) error
- type DepthError
- type Error
- type Wrapper
- func NewArray(l int) *Wrapper
- func NewBool(b bool) *Wrapper
- func NewDictionary() *Wrapper
- func NewFloat64(f float64) *Wrapper
- func NewInt(i int) *Wrapper
- func NewInt64(i int64) *Wrapper
- func NewNil() *Wrapper
- func NewObjectWrapper(i interface{}) (*Wrapper, error)
- func NewString(s string) *Wrapper
- func NewUint64(u uint64) *Wrapper
- func NewWrapper(i interface{}) (rd *Wrapper)
- func Unmarshal(unsafeRaw []byte) (*Wrapper, error)
- func UnmarshalWithMaxDepth(unsafeRaw []byte, maxDepth int) (*Wrapper, error)
- func WrapperFromObject(obj interface{}) (*Wrapper, error)
- func (i *Wrapper) AccessPath() string
- func (w *Wrapper) AssertEqAtPath(path string, obj *Wrapper, errp *error)
- func (rd *Wrapper) AtIndex(i int) *Wrapper
- func (rd *Wrapper) AtKey(s string) *Wrapper
- func (w *Wrapper) AtPath(path string) (ret *Wrapper)
- func (w *Wrapper) AtPathGetInt(path string) (ret int, ok bool)
- func (w *Wrapper) DeleteKey(s string) error
- func (w *Wrapper) DeleteValueAtPath(path string) error
- func (i *Wrapper) Error() (e error)
- func (rd *Wrapper) GetBool() (ret bool, err error)
- func (w *Wrapper) GetBoolVoid(bp *bool, errp *error)
- func (rd *Wrapper) GetBytes() (ret []byte, err error)
- func (w *Wrapper) GetBytesVoid(bp *[]byte, errp *error)
- func (i *Wrapper) GetData() (dat interface{}, err error)
- func (i *Wrapper) GetDataOrNil() interface{}
- func (i *Wrapper) GetDataVoid(dp *interface{}, ep *error)
- func (rd *Wrapper) GetFloat() (ret float64, err error)
- func (w *Wrapper) GetFloatVoid(fp *float64, errp *error)
- func (rd *Wrapper) GetInt() (i int, err error)
- func (rd *Wrapper) GetInt64() (ret int64, err error)
- func (w *Wrapper) GetInt64Void(ip *int64, errp *error)
- func (w *Wrapper) GetIntVoid(ip *int, errp *error)
- func (rd *Wrapper) GetInterface() (v interface{}, err error)
- func (rd *Wrapper) GetString() (ret string, err error)
- func (w *Wrapper) GetStringVoid(sp *string, errp *error)
- func (rd *Wrapper) GetUint() (u uint, err error)
- func (rd *Wrapper) GetUint64() (ret uint64, err error)
- func (w *Wrapper) GetUint64Void(ip *uint64, errp *error)
- func (w *Wrapper) GetUintVoid(ip *uint, errp *error)
- func (rd *Wrapper) IsNil() bool
- func (i *Wrapper) IsOk() bool
- func (i *Wrapper) Keys() (v []string, err error)
- func (rd *Wrapper) Len() (ret int, err error)
- func (w *Wrapper) Marshal() ([]byte, error)
- func (w *Wrapper) MarshalJSON() ([]byte, error)
- func (w *Wrapper) MarshalPretty() string
- func (w *Wrapper) MarshalToDebug() string
- func (w *Wrapper) NewError(format string, a ...interface{}) *Error
- func (w *Wrapper) SetIndex(i int, val *Wrapper) error
- func (w *Wrapper) SetKey(s string, val *Wrapper) error
- func (w *Wrapper) SetValueAtPath(path string, value *Wrapper) error
- func (rd *Wrapper) ToArray() (out *Wrapper, e error)
- func (rd *Wrapper) ToDictionary() (out *Wrapper, e error)
- func (w *Wrapper) UnmarshalAgain(i interface{}) (err error)
Constants ¶
const JSONDoubleQuotationMark = byte('"')
const JSONEscape = byte('\\')
const JSONLeftCurlyBracket = byte('{')
const JSONLeftSquareBracket = byte('[')
const JSONRightCurlyBracket = byte('}')
const JSONRightSquareBracket = byte(']')
Variables ¶
This section is empty.
Functions ¶
func Canonicalize ¶
func EnsureMaxDepth ¶
ensureMaxDepth returns an error if raw represents a valid JSON string whose deserialization's maximum depth exceeds maxDepth. If raw represents an invalid JSON string with a prefix that is a valid JSON prefix whose depth exceeds maxDepth, an error will be returned as well). See https://github.com/golang/go/blob/master/src/encoding/json/decode.go#L96. Otherwise, behavior is undefined and an error may or may not be returned. See the spec at https://json.org.
func EnsureMaxDepthDefault ¶
Types ¶
type DepthError ¶
type DepthError struct {
// contains filtered or unexported fields
}
func (DepthError) Error ¶
func (d DepthError) Error() string
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
func NewDictionary ¶
func NewDictionary() *Wrapper
func NewFloat64 ¶
func NewObjectWrapper ¶
NewObjectWrapper takes a Go object that has JSON field struct annotations and inserts it into a JSON wrapper. The serialization happens eagerly, and the object is copied into the wrapper, so that subsequent updates to the object will not be reflected in the Wrapper.
func NewWrapper ¶
func NewWrapper(i interface{}) (rd *Wrapper)
func UnmarshalWithMaxDepth ¶
func WrapperFromObject ¶
func (*Wrapper) AccessPath ¶
func (*Wrapper) AssertEqAtPath ¶
func (*Wrapper) DeleteValueAtPath ¶
func (*Wrapper) GetBoolVoid ¶
func (*Wrapper) GetBytesVoid ¶
func (*Wrapper) GetDataOrNil ¶
func (i *Wrapper) GetDataOrNil() interface{}
func (*Wrapper) GetDataVoid ¶
func (*Wrapper) GetFloatVoid ¶
func (*Wrapper) GetInt64Void ¶
func (*Wrapper) GetIntVoid ¶
func (*Wrapper) GetInterface ¶
func (*Wrapper) GetStringVoid ¶
func (*Wrapper) GetUint64Void ¶
func (*Wrapper) GetUintVoid ¶
func (*Wrapper) MarshalJSON ¶
MarshalJSON makes Wrapper satisfy the encoding/json.Marshaler interface.