MCPcopy Index your code
hub / github.com/expr-lang/expr / canSortSimply

Function canSortSimply

internal/spew/common.go:256–275  ·  view source on GitHub ↗

canSortSimply tests whether a reflect.Kind is a primitive that can be sorted directly, or whether it should be considered for sorting by surrogate keys (if the ConfigState allows it).

(kind reflect.Kind)

Source from the content-addressed store, hash-verified

254// directly, or whether it should be considered for sorting by surrogate keys
255// (if the ConfigState allows it).
256func canSortSimply(kind reflect.Kind) bool {
257 // This switch parallels valueSortLess, except for the default case.
258 switch kind {
259 case reflect.Bool:
260 return true
261 case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
262 return true
263 case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
264 return true
265 case reflect.Float32, reflect.Float64:
266 return true
267 case reflect.String:
268 return true
269 case reflect.Uintptr:
270 return true
271 case reflect.Array:
272 return true
273 }
274 return false
275}
276
277// Len returns the number of values in the slice. It is part of the
278// sort.Interface implementation.

Callers 1

newValuesSorterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…