1
0
mirror of https://github.com/json-iterator/go.git synced 2024-12-09 08:55:35 +02:00
json-iterator/feature_any_bool.go

138 lines
1.8 KiB
Go
Raw Normal View History

2017-01-23 02:45:57 +02:00
package jsoniter
type trueAny struct {
baseAny
2017-01-23 02:45:57 +02:00
}
func (any *trueAny) LastError() error {
return nil
}
func (any *trueAny) ToBool() bool {
return true
}
func (any *trueAny) ToInt() int {
return 1
}
func (any *trueAny) ToInt32() int32 {
return 1
}
func (any *trueAny) ToInt64() int64 {
return 1
}
2017-01-29 10:55:32 +02:00
func (any *trueAny) ToUint() uint {
return 1
}
func (any *trueAny) ToUint32() uint32 {
return 1
}
func (any *trueAny) ToUint64() uint64 {
return 1
}
2017-01-23 02:45:57 +02:00
func (any *trueAny) ToFloat32() float32 {
return 1
}
func (any *trueAny) ToFloat64() float64 {
return 1
}
func (any *trueAny) ToString() string {
return "true"
}
2017-01-26 08:56:31 +02:00
func (any *trueAny) WriteTo(stream *Stream) {
stream.WriteTrue()
}
2017-01-26 09:40:38 +02:00
func (any *trueAny) Parse() *Iterator {
return nil
}
2017-01-26 09:44:10 +02:00
func (any *trueAny) GetInterface() interface{} {
return true
}
2017-01-26 10:24:01 +02:00
func (any *trueAny) ValueType() ValueType {
return Bool
}
2017-06-19 15:21:20 +02:00
func (any *trueAny) MustBeValid() Any {
return any
}
2017-01-23 02:45:57 +02:00
type falseAny struct {
baseAny
2017-01-23 02:45:57 +02:00
}
func (any *falseAny) LastError() error {
return nil
}
func (any *falseAny) ToBool() bool {
return false
}
func (any *falseAny) ToInt() int {
return 0
}
func (any *falseAny) ToInt32() int32 {
return 0
}
func (any *falseAny) ToInt64() int64 {
return 0
}
2017-01-29 10:55:32 +02:00
func (any *falseAny) ToUint() uint {
return 0
}
func (any *falseAny) ToUint32() uint32 {
return 0
}
func (any *falseAny) ToUint64() uint64 {
return 0
}
2017-01-23 02:45:57 +02:00
func (any *falseAny) ToFloat32() float32 {
return 0
}
func (any *falseAny) ToFloat64() float64 {
return 0
}
func (any *falseAny) ToString() string {
return "false"
}
2017-01-26 08:56:31 +02:00
func (any *falseAny) WriteTo(stream *Stream) {
stream.WriteFalse()
}
2017-01-26 09:40:38 +02:00
func (any *falseAny) Parse() *Iterator {
return nil
}
2017-01-26 09:44:10 +02:00
func (any *falseAny) GetInterface() interface{} {
return false
}
2017-01-26 10:24:01 +02:00
func (any *falseAny) ValueType() ValueType {
return Bool
}
2017-06-19 15:21:20 +02:00
func (any *falseAny) MustBeValid() Any {
return any
}