jsonx

package
v0.0.0-...-cd938e1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustMarshal

func MustMarshal(v interface{}) []byte

func MustMarshal2String

func MustMarshal2String(v interface{}) string

func MustMarshalIndent

func MustMarshalIndent(v interface{}, prefix, indent string) []byte

func MustMarshalIndent2String

func MustMarshalIndent2String(v interface{}, prefix, indent string) string

func MustUnmarshal

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

MustUnmarshal > json.Unmarshal

func SafePretty

func SafePretty(v interface{}) string

SafePretty 打印出有缩进的json, 只为测试目的,忽略出错

Types

type Map

type Map struct {
	Map map[string]interface{}
}

func NewMap

func NewMap(mp map[string]interface{}) *Map

func Unmarshal2Map

func Unmarshal2Map(data []byte) (*Map, error)

func (*Map) Get

func (x *Map) Get(key string) (*Map, bool)

获取子项

func (*Map) GetInt

func (x *Map) GetInt(key string) (int, bool)

获取Int

func (*Map) GetInt32

func (x *Map) GetInt32(key string) (int32, bool)

获取Int32

func (*Map) GetInt32List

func (x *Map) GetInt32List(key string) ([]int32, bool)

获取Int32List

func (*Map) GetInt64

func (x *Map) GetInt64(key string) (int64, bool)

获取Int64

func (*Map) GetInt64List

func (x *Map) GetInt64List(key string) ([]int64, bool)

获取Int64List

func (*Map) GetIntList

func (x *Map) GetIntList(key string) ([]int, bool)

获取IntList

func (*Map) GetString

func (x *Map) GetString(key string) (string, bool)

获取String

func (*Map) GetStringList

func (x *Map) GetStringList(key string) ([]string, bool)

获取StringList

func (*Map) GetTime

func (x *Map) GetTime(key string, layout string) (time.Time, bool)

获取日期时间

func (*Map) GetValue

func (x *Map) GetValue(key string) (interface{}, bool)

获取值

func (*Map) Marshal

func (x *Map) Marshal() ([]byte, error)

func (*Map) SetValue

func (x *Map) SetValue(key string, value interface{})

设置值

Jump to

Keyboard shortcuts

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