OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package datastore | 5 package datastore |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "encoding/base64" | 9 "encoding/base64" |
10 "errors" | 10 "errors" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 func UpconvertUnderlyingType(o interface{}) interface{} { | 297 func UpconvertUnderlyingType(o interface{}) interface{} { |
298 if o == nil { | 298 if o == nil { |
299 return o | 299 return o |
300 } | 300 } |
301 | 301 |
302 v := reflect.ValueOf(o) | 302 v := reflect.ValueOf(o) |
303 t := v.Type() | 303 t := v.Type() |
304 switch v.Kind() { | 304 switch v.Kind() { |
305 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.In
t64: | 305 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.In
t64: |
306 o = v.Int() | 306 o = v.Int() |
| 307 case reflect.Uint8, reflect.Uint16, reflect.Uint32: |
| 308 o = int64(v.Uint()) |
307 case reflect.Bool: | 309 case reflect.Bool: |
308 o = v.Bool() | 310 o = v.Bool() |
309 case reflect.String: | 311 case reflect.String: |
310 if t != typeOfBSKey { | 312 if t != typeOfBSKey { |
311 o = v.String() | 313 o = v.String() |
312 } | 314 } |
313 case reflect.Float32, reflect.Float64: | 315 case reflect.Float32, reflect.Float64: |
314 o = v.Float() | 316 o = v.Float() |
315 case reflect.Slice: | 317 case reflect.Slice: |
316 if t.Elem().Kind() == reflect.Uint8 { | 318 if t.Elem().Kind() == reflect.Uint8 { |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 if string(s) == string(t) { | 982 if string(s) == string(t) { |
981 return 0, true | 983 return 0, true |
982 } | 984 } |
983 if string(s) < string(t) { | 985 if string(s) < string(t) { |
984 return -1, true | 986 return -1, true |
985 } | 987 } |
986 return 1, true | 988 return 1, true |
987 } | 989 } |
988 return 0, false | 990 return 0, false |
989 } | 991 } |
OLD | NEW |