2017-01-23 08:33:43 +08:00
|
|
|
package jsoniter
|
|
|
|
|
2017-01-26 16:24:01 +08:00
|
|
|
import "fmt"
|
|
|
|
|
2017-01-23 08:33:43 +08:00
|
|
|
type invalidAny struct {
|
2017-01-24 00:23:07 +08:00
|
|
|
baseAny
|
2017-01-26 16:24:01 +08:00
|
|
|
err error
|
2017-01-23 08:33:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) LastError() error {
|
2017-01-26 16:24:01 +08:00
|
|
|
return any.err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) ValueType() ValueType {
|
|
|
|
return Invalid
|
2017-01-23 08:33:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) ToBool() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) ToInt() int {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) ToInt32() int32 {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) ToInt64() int64 {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2017-01-29 16:55:32 +08:00
|
|
|
func (any *invalidAny) ToUint() uint {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) ToUint32() uint32 {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) ToUint64() uint64 {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2017-01-23 08:33:43 +08:00
|
|
|
func (any *invalidAny) ToFloat32() float32 {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) ToFloat64() float64 {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (any *invalidAny) ToString() string {
|
|
|
|
return ""
|
|
|
|
}
|
2017-01-24 00:23:07 +08:00
|
|
|
|
2017-01-26 14:56:31 +08:00
|
|
|
func (any *invalidAny) WriteTo(stream *Stream) {
|
|
|
|
}
|
|
|
|
|
2017-01-24 00:23:07 +08:00
|
|
|
func (any *invalidAny) Get(path ...interface{}) Any {
|
2017-01-26 16:24:01 +08:00
|
|
|
if any.err == nil {
|
|
|
|
return &invalidAny{baseAny{}, fmt.Errorf("get %v from invalid", path)}
|
|
|
|
} else {
|
|
|
|
return &invalidAny{baseAny{}, fmt.Errorf("%v, get %v from invalid", any.err, path)}
|
|
|
|
}
|
2017-01-24 00:23:07 +08:00
|
|
|
}
|
2017-01-26 15:40:38 +08:00
|
|
|
|
|
|
|
func (any *invalidAny) Parse() *Iterator {
|
|
|
|
return nil
|
|
|
|
}
|
2017-01-26 15:44:10 +08:00
|
|
|
|
|
|
|
func (any *invalidAny) GetInterface() interface{} {
|
|
|
|
return nil
|
|
|
|
}
|