json

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

README

json

fast but flexible json library

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedChar = errors.New("unexpected char")
	ErrOverflow       = errors.New("type overflow")
	ErrOutOfRange     = errors.New("out of range")
	ErrExpectedValue  = errors.New("expected value")
	ErrUnexpectedEnd  = errors.New("unexpected end")
	ErrNoSuchKey      = errors.New("no such key")
	ErrConversion     = errors.New("type conversion")
)

Functions

func Marshal

func Marshal(r interface{}) ([]byte, error)

func MarshalV0

func MarshalV0(v interface{}) ([]byte, error)

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

func UnmarshalV0

func UnmarshalV0(data []byte, r interface{}) error

Types

type ArrayIter

type ArrayIter struct {
	// contains filtered or unexported fields
}

func (*ArrayIter) HasNext

func (it *ArrayIter) HasNext() bool

func (*ArrayIter) Next

func (it *ArrayIter) Next() *Value

type Error

type Error struct {
	// contains filtered or unexported fields
}

func NewError

func NewError(b []byte, s int, e error) Error

func (Error) Error

func (e Error) Error() string

func (Error) Format

func (e Error) Format(s fmt.State, c rune)

func (Error) Pos

func (e Error) Pos() int

type ObjectIter

type ObjectIter struct {
	// contains filtered or unexported fields
}

func (*ObjectIter) HasNext

func (it *ObjectIter) HasNext() bool

func (*ObjectIter) Next

func (it *ObjectIter) Next() (k, v *Value)

type StructField

type StructField struct {
	I         int
	Kind      reflect.Kind
	Ptr       uintptr
	FastPath  bool
	FastErase bool
}

type StructMap

type StructMap struct {
	// contains filtered or unexported fields
}

type Type

type Type int
const (
	Null Type = iota
	Bool
	Number
	String
	Array
	Object
)

func (Type) String

func (i Type) String() string

type Value

type Value struct {
	// contains filtered or unexported fields
}

func Parse

func Parse(b []byte) (*Value, error)

func ParseString

func ParseString(s string) (*Value, error)

func Wrap

func Wrap(b []byte) *Value

func WrapString

func WrapString(s string) *Value

func WrapStringUnsafe

func WrapStringUnsafe(s string) *Value

func (*Value) ArrayIter

func (v *Value) ArrayIter() (*ArrayIter, error)

func (*Value) Bool

func (v *Value) Bool() (bool, error)

func (*Value) Buffer

func (v *Value) Buffer() []byte

func (*Value) Bytes

func (v *Value) Bytes() []byte

func (*Value) CastBool

func (v *Value) CastBool() (bool, error)

func (*Value) CheckBytes

func (v *Value) CheckBytes() ([]byte, error)

func (*Value) CheckString

func (v *Value) CheckString() (string, error)

func (*Value) Float64

func (v *Value) Float64() (float64, error)

func (*Value) Get

func (v *Value) Get(ks ...interface{}) (*Value, error)

func (*Value) Int

func (v *Value) Int() (int, error)

func (*Value) Int64

func (v *Value) Int64() (int64, error)

func (*Value) IsNull

func (v *Value) IsNull() (bool, error)

func (*Value) MustBool

func (v *Value) MustBool() bool

func (*Value) MustCheckBytes

func (v *Value) MustCheckBytes() []byte

func (*Value) MustCheckString

func (v *Value) MustCheckString() string

func (*Value) MustFloat64

func (v *Value) MustFloat64() float64

func (*Value) MustGet

func (v *Value) MustGet(ks ...interface{}) *Value

func (*Value) MustInt

func (v *Value) MustInt() int

func (*Value) MustInt64

func (v *Value) MustInt64() int64

func (*Value) MustUint

func (v *Value) MustUint() uint

func (*Value) MustUint64

func (v *Value) MustUint64() uint64

func (*Value) ObjectIter

func (v *Value) ObjectIter() (*ObjectIter, error)

func (*Value) String

func (v *Value) String() string

func (*Value) Type

func (v *Value) Type() (Type, error)

func (*Value) Uint

func (v *Value) Uint() (uint, error)

func (*Value) Uint64

func (v *Value) Uint64() (uint64, error)

func (*Value) Unmarshal

func (v *Value) Unmarshal(r interface{}) error

func (*Value) UnmarshalV0

func (v *Value) UnmarshalV0(r interface{}) error

type WriterV0

type WriterV0 struct {
	// contains filtered or unexported fields
}

func (*WriterV0) Marshal

func (w *WriterV0) Marshal(v interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL