ByNamespacedName sorts a slice of objects by Namespace/Name in alphabetical order. Use this for namespace-scoped resources.
(items []T)
| 34 | // ByNamespacedName sorts a slice of objects by Namespace/Name in alphabetical order. |
| 35 | // Use this for namespace-scoped resources. |
| 36 | func ByNamespacedName[T any, PT interface { |
| 37 | *T |
| 38 | NamespaceGetter |
| 39 | }](items []T) { |
| 40 | slices.SortFunc(items, func(a, b T) int { |
| 41 | pa, pb := PT(&a), PT(&b) |
| 42 | if res := strings.Compare(pa.GetNamespace(), pb.GetNamespace()); res != 0 { |
| 43 | return res |
| 44 | } |
| 45 | return strings.Compare(pa.GetName(), pb.GetName()) |
| 46 | }) |
| 47 | } |
nothing calls this directly
no test coverage detected