jsonx

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SliceRand = "sha.jsonx.rand"
)

Variables

View Source
var ErrUnexpectedJSON = errors.New("sha.jsonx: unexpected json structure")

Functions

func Marshal

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

func NewEncoder

func NewEncoder(w io.Writer) *jsoniter.Encoder

func Unmarshal

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

Types

type JSONValue

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

func NewObject

func NewObject(raw []byte) (*JSONValue, error)

func (*JSONValue) IsNull

func (obj *JSONValue) IsNull(keys ...string) (bool, error)

func (*JSONValue) Peek

func (obj *JSONValue) Peek(keys ...string) (interface{}, error)

func (*JSONValue) PeekBool

func (obj *JSONValue) PeekBool(keys ...string) (bool, error)

func (*JSONValue) PeekBoolDefault

func (obj *JSONValue) PeekBoolDefault(def bool, keys ...string) bool

func (*JSONValue) PeekDefault

func (obj *JSONValue) PeekDefault(def interface{}, keys ...string) interface{}

func (*JSONValue) PeekFloat

func (obj *JSONValue) PeekFloat(keys ...string) (float64, error)

func (*JSONValue) PeekFloatDefault

func (obj *JSONValue) PeekFloatDefault(def float64, keys ...string) float64

func (*JSONValue) PeekInt

func (obj *JSONValue) PeekInt(keys ...string) (int64, error)

func (*JSONValue) PeekIntDefault

func (obj *JSONValue) PeekIntDefault(def int64, keys ...string) int64

func (*JSONValue) PeekMap

func (obj *JSONValue) PeekMap(keys ...string) (map[string]interface{}, error)

func (*JSONValue) PeekSlice

func (obj *JSONValue) PeekSlice(keys ...string) ([]interface{}, error)

func (*JSONValue) PeekString

func (obj *JSONValue) PeekString(keys ...string) (string, error)

func (*JSONValue) PeekStringDefault

func (obj *JSONValue) PeekStringDefault(def string, keys ...string) string

func (*JSONValue) PeekTimeFromString

func (obj *JSONValue) PeekTimeFromString(layout string, keys ...string) (time.Time, error)

func (*JSONValue) PeekTimeFromUnix

func (obj *JSONValue) PeekTimeFromUnix(keys ...string) (time.Time, error)

func (*JSONValue) String

func (obj *JSONValue) String() string

Jump to

Keyboard shortcuts

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