MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / Less

Method Less

pkg/util/json/json.go:551–560  ·  view source on GitHub ↗
(i, j int)

Source from the content-addressed store, hash-verified

549}
550
551func (s *pairSorter) Less(i, j int) bool {
552 cmp := strings.Compare(string(s.pairs[i].k), string(s.pairs[j].k))
553 if cmp != 0 {
554 return cmp == -1
555 }
556 s.hasNonUnique = true
557 // The element with greater order has lower rank when their keys
558 // are same, since unique algorithm will prefer first element.
559 return s.orders[i] > s.orders[j]
560}
561
562func (s *pairSorter) Swap(i, j int) {
563 s.pairs[i], s.orders[i], s.pairs[j], s.orders[j] = s.pairs[j], s.orders[j], s.pairs[i], s.orders[i]

Callers 1

moveTopKToFrontFunction · 0.45

Calls 1

CompareMethod · 0.65

Tested by

no test coverage detected