MCPcopy Create free account
hub / github.com/dolthub/doltgresql / Compare

Method Compare

postgres/parser/json/json.go:457–475  ·  view source on GitHub ↗
(other JSON)

Source from the content-addressed store, hash-verified

455}
456
457func (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
477func (j jsonArray) Compare(other JSON) (int, error) {
478 cmp := cmpJSONTypes(j.Type(), other.Type())

Callers

nothing calls this directly

Calls 4

TypeMethod · 0.95
cmpJSONTypesFunction · 0.85
decodeIfNeededFunction · 0.85
TypeMethod · 0.65

Tested by

no test coverage detected