trimStringSlice trims whitespace from each element and drops empty strings.
(ss []string)
| 1313 | // trimStringSlice trims whitespace from each element and drops empty |
| 1314 | // strings. |
| 1315 | func trimStringSlice(ss []string) []string { |
| 1316 | if ss == nil { |
| 1317 | return nil |
| 1318 | } |
| 1319 | out := make([]string, 0, len(ss)) |
| 1320 | for _, s := range ss { |
| 1321 | if trimmed := strings.TrimSpace(s); trimmed != "" { |
| 1322 | out = append(out, trimmed) |
| 1323 | } |
| 1324 | } |
| 1325 | return out |
| 1326 | } |
| 1327 | |
| 1328 | // coalesceStringSlice returns ss if non-nil, otherwise an empty |
| 1329 | // non-nil slice. This prevents pq.Array from sending NULL for |
no outgoing calls
no test coverage detected