Documentation ¶
Overview ¶
用于处理松散的JSON数据。
Index ¶
- func AsBool(v interface{}, def bool) bool
- func AsStr(v interface{}, def string) string
- func AsStringArray(v interface{}, def []string) []string
- func AsTime(v interface{}, def time.Time) time.Time
- func BoolAsInt(b bool) int
- func Clone(v interface{}) (interface{}, error)
- func FromFreejson(freejsonData interface{}, v interface{}) error
- func Marshal(v interface{}) ([]byte, error)
- func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
- func MarshalIndentString(v interface{}, def string) string
- func MarshalString(v interface{}, def string) string
- func MustClone(v interface{}) interface{}
- func ToBool(v interface{}, def bool) bool
- func ToFloat64(v interface{}, def float64) float64
- func ToFreejson(v interface{}) (interface{}, error)
- func ToInt(v interface{}, def int) int
- func ToInt64(v interface{}, def int64) int64
- func ToStr(v interface{}, def string) string
- func ToTime(v interface{}, def time.Time) time.Time
- func Unmarshal(data []byte, valDec ValueDecoder) (interface{}, error)
- type Array
- func (a Array) Add(vs ...interface{}) Array
- func (a Array) ArrayAt(index int, def Array) Array
- func (a Array) AsArrayAt(index int, def Array) Array
- func (a Array) AsStrAt(index int, def string) string
- func (a Array) AsStringArrayAt(index int, def []string) []string
- func (a Array) AsTimeAt(index int, def time.Time) time.Time
- func (a Array) BoolAt(index int, def bool) bool
- func (a Array) Clear() Array
- func (a Array) Each(f func(index int, v interface{}))
- func (a Array) EachElem(f func(v interface{}))
- func (a Array) EachIndex(f func(index int))
- func (a Array) FieldType(index int) ValueType
- func (a Array) Filter(result Array, pred func(v interface{}) bool) Array
- func (a Array) Float64At(index int, def float64) float64
- func (a Array) Has(index int) bool
- func (a Array) Int64At(index int, def int64) int64
- func (a Array) IntAt(index, def int) int
- func (a Array) IntfAt(index int, def interface{}) interface{}
- func (a Array) Len() int
- func (a Array) ObjectAt(index int, def Object) Object
- func (a Array) RemoveIf(pred func(index int, v interface{}) bool) Array
- func (a Array) Set(index int, v interface{})
- func (a Array) StrAt(index int, def string) string
- func (a Array) String() string
- func (a Array) TimeAt(index int, def time.Time) time.Time
- type Cloneable
- type Object
- func (o Object) ArrayField(f string, def Array) Array
- func (o Object) AsArrayField(f string, def Array) Array
- func (o Object) AsBoolField(f string, def bool) bool
- func (o Object) AsStrField(f, def string) string
- func (o Object) AsStringArrayField(f string, def []string) []string
- func (o Object) AsTimeField(f string, def time.Time) time.Time
- func (o Object) BoolField(f string, def bool) bool
- func (o Object) BoolFieldAsInt(f string, def bool) int
- func (o Object) Clear()
- func (o Object) Each(f func(k string, v interface{}))
- func (o Object) EachKey(f func(k string))
- func (o Object) EachValue(f func(v interface{}))
- func (o Object) Ensure(f string, v interface{})
- func (o Object) EnsureF(f string, vf func(f string) (interface{}, error)) error
- func (o Object) FieldType(f string) ValueType
- func (o Object) Filter(result Object, pred func(k string, v interface{}) bool) Object
- func (o Object) Float64Field(f string, def float64) float64
- func (o Object) Has(f string) bool
- func (o Object) Int64Field(f string, def int64) int64
- func (o Object) IntField(f string, def int) int
- func (o Object) IntfField(f string, def interface{}) interface{}
- func (o Object) Keys() []string
- func (o Object) Len() int
- func (o Object) ObjectField(f string, def Object) Object
- func (o Object) Remove(f string)
- func (o Object) RemoveIf(pred func(f string, v interface{}) bool)
- func (o Object) Set(f string, v interface{})
- func (o Object) SetIfExists(f string, v interface{})
- func (o Object) SetNotNil(f string, v interface{})
- func (o Object) SetNotNilF(f string, vf func(f string) (interface{}, error)) error
- func (o Object) StrField(f, def string) string
- func (o Object) String() string
- func (o Object) TimeField(f string, def time.Time) time.Time
- type ValueDecoder
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsStringArray ¶
func FromFreejson ¶
func FromFreejson(freejsonData interface{}, v interface{}) error
func MarshalIndent ¶
func MarshalIndentString ¶
func MarshalString ¶
func ToFreejson ¶
func ToFreejson(v interface{}) (interface{}, error)
func Unmarshal ¶
func Unmarshal(data []byte, valDec ValueDecoder) (interface{}, error)
Types ¶
type Object ¶
type Object map[string]interface{}
func (Object) AsStrField ¶
func (Object) AsStringArrayField ¶
func (Object) SetIfExists ¶
func (Object) SetNotNilF ¶
type ValueDecoder ¶
type ValueDecoder func(interface{}) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.