MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / Compare

Method Compare

pkg/util/json/json.go:393–405  ·  view source on GitHub ↗
(other JSON)

Source from the content-addressed store, hash-verified

391}
392
393func (j jsonNumber) Compare(other JSON) (int, error) {
394 cmp := cmpJSONTypes(j.Type(), other.Type())
395 if cmp != 0 {
396 return cmp, nil
397 }
398 var err error
399 if other, err = decodeIfNeeded(other); err != nil {
400 return 0, err
401 }
402 dec := apd.Decimal(j)
403 o := apd.Decimal(other.(jsonNumber))
404 return dec.Cmp(&o), nil
405}
406
407func (j jsonString) Compare(other JSON) (int, error) {
408 cmp := cmpJSONTypes(j.Type(), other.Type())

Callers 1

slowContainsMethod · 0.95

Calls 4

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

Tested by

no test coverage detected