myjson

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAllNumber added in v1.1.3

func IsAllNumber(v Array) bool

func IsNumber added in v1.1.3

func IsNumber(v interface{}) bool

func Marshal

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

func Unmarshal

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

Types

type Array

type Array []interface{}

func NewArray

func NewArray(v ...interface{}) Array

func ToArray added in v1.1.3

func ToArray(v interface{}) (Array, error)

func (Array) Get

func (a Array) Get(idx int) interface{}

func (Array) Has added in v1.1.3

func (a Array) Has(idx int) bool

func (Array) Set

func (a Array) Set(idx int, v interface{}) Array

func (Array) String

func (a Array) String() string

type Boolean

type Boolean bool

func ToBoolean added in v1.1.9

func ToBoolean(v interface{}) (Boolean, error)

func (Boolean) String

func (b Boolean) String() string

type ExtJSONMatcher added in v1.1.4

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

func MakeExtJSONMatcher added in v1.1.4

func MakeExtJSONMatcher(v interface{}) ExtJSONMatcher

func NewExtJSONMatcher added in v1.1.5

func NewExtJSONMatcher(v interface{}) *ExtJSONMatcher

func (ExtJSONMatcher) Matches added in v1.1.4

func (m ExtJSONMatcher) Matches(v interface{}) bool

func (ExtJSONMatcher) Unwrap added in v1.1.4

func (m ExtJSONMatcher) Unwrap() interface{}

type ExtRegexp

type ExtRegexp *regexp.Regexp

type Number

type Number float64

func ToNumber added in v1.1.3

func ToNumber(v interface{}) (Number, error)

func (Number) String

func (n Number) String() string

type Object

type Object map[string]interface{}

func ToObject

func ToObject(v interface{}) (Object, error)

func (Object) Get

func (o Object) Get(name string) interface{}

func (Object) GetArray

func (o Object) GetArray(name string) (Array, error)

func (Object) GetBoolean added in v1.1.9

func (o Object) GetBoolean(name string) (Boolean, error)

func (Object) GetNumber

func (o Object) GetNumber(name string) (Number, error)

func (Object) GetObject

func (o Object) GetObject(name string) (Object, error)

func (Object) GetString

func (o Object) GetString(name string) (String, error)

func (Object) Has

func (o Object) Has(name string) bool

func (Object) Set

func (o Object) Set(name string, v interface{}) Object

func (Object) SetByPath

func (o Object) SetByPath(path *Path, v interface{}) (Object, error)

func (Object) String

func (o Object) String() string

type Path

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

func NewPath

func NewPath(paths ...interface{}) *Path

func ParsePath

func ParsePath(pathStr string) (*Path, error)

func (*Path) Append

func (p *Path) Append(v interface{})

func (*Path) RemoveLast

func (p *Path) RemoveLast()

func (*Path) SetLast

func (p *Path) SetLast(v interface{})

func (*Path) String

func (p *Path) String() string

type String

type String string

func ToString

func ToString(v interface{}) (String, error)

func (String) String

func (s String) String() string

Jump to

Keyboard shortcuts

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