mirror of
https://github.com/json-iterator/go.git
synced 2025-06-12 22:47:42 +02:00
add Any GetInterface
This commit is contained in:
parent
97472ecd96
commit
9abc2f52b0
@ -18,6 +18,7 @@ type Any interface {
|
|||||||
SetArray(newList []Any) bool
|
SetArray(newList []Any) bool
|
||||||
GetObject() map[string]Any
|
GetObject() map[string]Any
|
||||||
SetObject(map[string]Any) bool
|
SetObject(map[string]Any) bool
|
||||||
|
GetInterface() interface{}
|
||||||
WriteTo(stream *Stream)
|
WriteTo(stream *Stream)
|
||||||
Parse() *Iterator
|
Parse() *Iterator
|
||||||
}
|
}
|
||||||
|
@ -271,3 +271,8 @@ func (any *arrayLazyAny) WriteTo(stream *Stream) {
|
|||||||
stream.WriteVal(any.cache)
|
stream.WriteVal(any.cache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *arrayLazyAny) GetInterface() interface{} {
|
||||||
|
any.fillCache()
|
||||||
|
return any.cache
|
||||||
|
}
|
@ -44,6 +44,10 @@ func (any *trueAny) Parse() *Iterator {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *trueAny) GetInterface() interface{} {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
type falseAny struct {
|
type falseAny struct {
|
||||||
baseAny
|
baseAny
|
||||||
}
|
}
|
||||||
@ -87,3 +91,7 @@ func (any *falseAny) WriteTo(stream *Stream) {
|
|||||||
func (any *falseAny) Parse() *Iterator {
|
func (any *falseAny) Parse() *Iterator {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *falseAny) GetInterface() interface{} {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
@ -74,3 +74,8 @@ func (any *floatLazyAny) ToString() string {
|
|||||||
func (any *floatLazyAny) WriteTo(stream *Stream) {
|
func (any *floatLazyAny) WriteTo(stream *Stream) {
|
||||||
stream.Write(any.buf)
|
stream.Write(any.buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *floatLazyAny) GetInterface() interface{} {
|
||||||
|
any.fillCache()
|
||||||
|
return any.cache
|
||||||
|
}
|
@ -76,6 +76,11 @@ func (any *intLazyAny) WriteTo(stream *Stream) {
|
|||||||
stream.Write(any.buf)
|
stream.Write(any.buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *intLazyAny) GetInterface() interface{} {
|
||||||
|
any.fillCache()
|
||||||
|
return any.cache
|
||||||
|
}
|
||||||
|
|
||||||
type intAny struct {
|
type intAny struct {
|
||||||
baseAny
|
baseAny
|
||||||
err error
|
err error
|
||||||
@ -121,3 +126,7 @@ func (any *intAny) WriteTo(stream *Stream) {
|
|||||||
func (any *intAny) Parse() *Iterator {
|
func (any *intAny) Parse() *Iterator {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *intAny) GetInterface() interface{} {
|
||||||
|
return any.val
|
||||||
|
}
|
@ -46,3 +46,7 @@ func (any *invalidAny) Get(path ...interface{}) Any {
|
|||||||
func (any *invalidAny) Parse() *Iterator {
|
func (any *invalidAny) Parse() *Iterator {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *invalidAny) GetInterface() interface{} {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -43,3 +43,7 @@ func (any *nilAny) WriteTo(stream *Stream) {
|
|||||||
func (any *nilAny) Parse() *Iterator {
|
func (any *nilAny) Parse() *Iterator {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *nilAny) GetInterface() interface{} {
|
||||||
|
return nil
|
||||||
|
}
|
@ -292,3 +292,8 @@ func (any *objectLazyAny) WriteTo(stream *Stream) {
|
|||||||
stream.WriteVal(any.cache)
|
stream.WriteVal(any.cache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *objectLazyAny) GetInterface() interface{} {
|
||||||
|
any.fillCache()
|
||||||
|
return any.cache
|
||||||
|
}
|
@ -101,3 +101,8 @@ func (any *stringLazyAny) ToString() string {
|
|||||||
func (any *stringLazyAny) WriteTo(stream *Stream) {
|
func (any *stringLazyAny) WriteTo(stream *Stream) {
|
||||||
stream.Write(any.buf)
|
stream.Write(any.buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (any *stringLazyAny) GetInterface() interface{} {
|
||||||
|
any.fillCache()
|
||||||
|
return any.cache
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user