You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: locality.go
    path of file: ./repos/cockroach/pkg/sql/opt/constraint
    
    the code of the file until where you have to start completion: // Copyright 2022 The Cockroach Authors.
//
// Use of this software is governed by the 
    
func compare(prefixInfo partition.Prefix, span *Span, ps partition.PrefixSorter) int {
	prefix := prefixInfo.Prefix
	prefixLength := len(prefix)
	spanPrefixLength := span.Prefix(ps.EvalCtx)
	// Longer prefixes sort before shorter ones.
	// The span prefix is allowed to be longer than the partition prefix and still
	// match.
	if prefixLength > spanPrefixLength {
		return -1
	}

	// Look for an exact match on the shared prefix.
	for k, datum := range prefix {
		compareResult := datum.Compare(ps.EvalCtx, span.StartKey().Value(k))
		if compareResult != 0 {
			return compareResult
		}
	}
	return 0
}