matchKey returns the value whose key matches column case-insensitively (trimming surrounding whitespace).
(m map[string]T, column string)
| 213 | // matchKey returns the value whose key matches column case-insensitively |
| 214 | // (trimming surrounding whitespace). |
| 215 | func matchKey[T any](m map[string]T, column string) (T, bool) { |
| 216 | for k, v := range m { |
| 217 | if strings.EqualFold(strings.TrimSpace(k), strings.TrimSpace(column)) { |
| 218 | return v, true |
| 219 | } |
| 220 | } |
| 221 | var zero T |
| 222 | return zero, false |
| 223 | } |
| 224 | |
| 225 | func filterNonEmpty(values []string) []string { |
| 226 | out := make([]string, 0, len(values)) |