Serge Bazanski | cc25bdf | 2018-10-25 14:02:58 +0200 | [diff] [blame] | 1 | package runtime |
| 2 | |
| 3 | // Values typically represent parameters on a http request. |
| 4 | type Values map[string][]string |
| 5 | |
| 6 | // GetOK returns the values collection for the given key. |
| 7 | // When the key is present in the map it will return true for hasKey. |
| 8 | // When the value is not empty it will return true for hasValue. |
| 9 | func (v Values) GetOK(key string) (value []string, hasKey bool, hasValue bool) { |
| 10 | value, hasKey = v[key] |
| 11 | if !hasKey { |
| 12 | return |
| 13 | } |
| 14 | if len(value) == 0 { |
| 15 | return |
| 16 | } |
| 17 | hasValue = true |
| 18 | return |
| 19 | } |