(other JSON)
| 455 | } |
| 456 | |
| 457 | func (j jsonString) Compare(other JSON) (int, error) { |
| 458 | cmp := cmpJSONTypes(j.Type(), other.Type()) |
| 459 | if cmp != 0 { |
| 460 | return cmp, nil |
| 461 | } |
| 462 | // TODO(justin): we should optimize this, we don't have to decode the whole thing. |
| 463 | var err error |
| 464 | if other, err = decodeIfNeeded(other); err != nil { |
| 465 | return 0, err |
| 466 | } |
| 467 | o := other.(jsonString) |
| 468 | if o > j { |
| 469 | return -1, nil |
| 470 | } |
| 471 | if o < j { |
| 472 | return 1, nil |
| 473 | } |
| 474 | return 0, nil |
| 475 | } |
| 476 | |
| 477 | func (j jsonArray) Compare(other JSON) (int, error) { |
| 478 | cmp := cmpJSONTypes(j.Type(), other.Type()) |
nothing calls this directly
no test coverage detected