MCPcopy Create free account
hub / github.com/bytebase/bytebase / sortSCCsByMin

Function sortSCCsByMin

backend/plugin/parser/pg/query_span_loader.go:499–503  ·  view source on GitHub ↗

sortSCCsByMin sorts a slice of SCC indices in place by the lex-smallest sortKey among each SCC's members. Stable ordering.

(indices []int, sccs [][]*objectEntry)

Source from the content-addressed store, hash-verified

497// sortSCCsByMin sorts a slice of SCC indices in place by the lex-smallest
498// sortKey among each SCC's members. Stable ordering.
499func sortSCCsByMin(indices []int, sccs [][]*objectEntry) {
500 slices.SortStableFunc(indices, func(a, b int) int {
501 return cmp.Compare(minSortKey(sccs[a]), minSortKey(sccs[b]))
502 })
503}
504
505func minSortKey(scc []*objectEntry) string {
506 if len(scc) == 0 {

Callers 1

topoSortObjectsFunction · 0.85

Calls 1

minSortKeyFunction · 0.85

Tested by

no test coverage detected