Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit d249b05

Browse files
committed
rename ValueType, to avoid collision with json.Number
1 parent abbd16d commit d249b05

26 files changed

+110
-110
lines changed

extra/fuzzy_decoder.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ type tolerateEmptyArrayDecoder struct {
158158
}
159159

160160
func (decoder *tolerateEmptyArrayDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) {
161-
if iter.WhatIsNext() == jsoniter.Array {
161+
if iter.WhatIsNext() == jsoniter.ArrayValue {
162162
iter.Skip()
163163
newIter := iter.Pool().BorrowIterator([]byte("{}"))
164164
defer iter.Pool().ReturnIterator(newIter)
@@ -174,11 +174,11 @@ type fuzzyStringDecoder struct {
174174
func (decoder *fuzzyStringDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) {
175175
valueType := iter.WhatIsNext()
176176
switch valueType {
177-
case jsoniter.Number:
177+
case jsoniter.NumberValue:
178178
var number json.Number
179179
iter.ReadVal(&number)
180180
*((*string)(ptr)) = string(number)
181-
case jsoniter.String:
181+
case jsoniter.StringValue:
182182
*((*string)(ptr)) = iter.ReadString()
183183
default:
184184
iter.ReportError("fuzzyStringDecoder", "not number or string")
@@ -193,11 +193,11 @@ func (decoder *fuzzyIntegerDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It
193193
valueType := iter.WhatIsNext()
194194
var str string
195195
switch valueType {
196-
case jsoniter.Number:
196+
case jsoniter.NumberValue:
197197
var number json.Number
198198
iter.ReadVal(&number)
199199
str = string(number)
200-
case jsoniter.String:
200+
case jsoniter.StringValue:
201201
str = iter.ReadString()
202202
default:
203203
iter.ReportError("fuzzyIntegerDecoder", "not number or string")
@@ -218,9 +218,9 @@ func (decoder *fuzzyFloat32Decoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It
218218
valueType := iter.WhatIsNext()
219219
var str string
220220
switch valueType {
221-
case jsoniter.Number:
221+
case jsoniter.NumberValue:
222222
*((*float32)(ptr)) = iter.ReadFloat32()
223-
case jsoniter.String:
223+
case jsoniter.StringValue:
224224
str = iter.ReadString()
225225
newIter := iter.Pool().BorrowIterator([]byte(str))
226226
defer iter.Pool().ReturnIterator(newIter)
@@ -240,9 +240,9 @@ func (decoder *fuzzyFloat64Decoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It
240240
valueType := iter.WhatIsNext()
241241
var str string
242242
switch valueType {
243-
case jsoniter.Number:
243+
case jsoniter.NumberValue:
244244
*((*float64)(ptr)) = iter.ReadFloat64()
245-
case jsoniter.String:
245+
case jsoniter.StringValue:
246246
str = iter.ReadString()
247247
newIter := iter.Pool().BorrowIterator([]byte(str))
248248
defer iter.Pool().ReturnIterator(newIter)

feature_adapter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (adapter *Decoder) Buffered() io.Reader {
9090
return bytes.NewReader(remaining)
9191
}
9292

93-
// UseNumber for number JSON element, use float64 or json.Number (alias of string)
93+
// UseNumber for number JSON element, use float64 or json.NumberValue (alias of string)
9494
func (adapter *Decoder) UseNumber() {
9595
origCfg := adapter.iter.cfg.configBeforeFrozen
9696
origCfg.UseNumber = true

feature_any_array.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type arrayLazyAny struct {
1313
}
1414

1515
func (any *arrayLazyAny) ValueType() ValueType {
16-
return Array
16+
return ArrayValue
1717
}
1818

1919
func (any *arrayLazyAny) MustBeValid() Any {
@@ -117,7 +117,7 @@ func (any *arrayLazyAny) Get(path ...interface{}) Any {
117117
arr := make([]Any, 0)
118118
iter.ReadArrayCB(func(iter *Iterator) bool {
119119
found := iter.readAny().Get(path[1:]...)
120-
if found.ValueType() != Invalid {
120+
if found.ValueType() != InvalidValue {
121121
arr = append(arr, found)
122122
}
123123
return true
@@ -162,7 +162,7 @@ func wrapArray(val interface{}) *arrayAny {
162162
}
163163

164164
func (any *arrayAny) ValueType() ValueType {
165-
return Array
165+
return ArrayValue
166166
}
167167

168168
func (any *arrayAny) MustBeValid() Any {
@@ -253,7 +253,7 @@ func (any *arrayAny) Get(path ...interface{}) Any {
253253
mappedAll := make([]Any, 0)
254254
for i := 0; i < any.val.Len(); i++ {
255255
mapped := Wrap(any.val.Index(i).Interface()).Get(path[1:]...)
256-
if mapped.ValueType() != Invalid {
256+
if mapped.ValueType() != InvalidValue {
257257
mappedAll = append(mappedAll, mapped)
258258
}
259259
}

feature_any_bool.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (any *trueAny) GetInterface() interface{} {
6161
}
6262

6363
func (any *trueAny) ValueType() ValueType {
64-
return Bool
64+
return BoolValue
6565
}
6666

6767
func (any *trueAny) MustBeValid() Any {
@@ -129,7 +129,7 @@ func (any *falseAny) GetInterface() interface{} {
129129
}
130130

131131
func (any *falseAny) ValueType() ValueType {
132-
return Bool
132+
return BoolValue
133133
}
134134

135135
func (any *falseAny) MustBeValid() Any {

feature_any_float.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func (any *floatAny) Parse() *Iterator {
1414
}
1515

1616
func (any *floatAny) ValueType() ValueType {
17-
return Number
17+
return NumberValue
1818
}
1919

2020
func (any *floatAny) MustBeValid() Any {

feature_any_int32.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func (any *int32Any) LastError() error {
1414
}
1515

1616
func (any *int32Any) ValueType() ValueType {
17-
return Number
17+
return NumberValue
1818
}
1919

2020
func (any *int32Any) MustBeValid() Any {

feature_any_int64.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func (any *int64Any) LastError() error {
1414
}
1515

1616
func (any *int64Any) ValueType() ValueType {
17-
return Number
17+
return NumberValue
1818
}
1919

2020
func (any *int64Any) MustBeValid() Any {

feature_any_invalid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (any *invalidAny) LastError() error {
1616
}
1717

1818
func (any *invalidAny) ValueType() ValueType {
19-
return Invalid
19+
return InvalidValue
2020
}
2121

2222
func (any *invalidAny) MustBeValid() Any {

feature_any_nil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ func (any *nilAny) LastError() error {
99
}
1010

1111
func (any *nilAny) ValueType() ValueType {
12-
return Nil
12+
return NilValue
1313
}
1414

1515
func (any *nilAny) MustBeValid() Any {

feature_any_number.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type numberLazyAny struct {
1010
}
1111

1212
func (any *numberLazyAny) ValueType() ValueType {
13-
return Number
13+
return NumberValue
1414
}
1515

1616
func (any *numberLazyAny) MustBeValid() Any {

0 commit comments

Comments
 (0)