Get the first value associated with the given key. If there are any values associated with the key, the value return has the value and ok is set to true. If there are no values for the given key, value is "" and ok is false. If you need access to multiple values, use the map directly.
(key string)
| 24 | // true. If there are no values for the given key, value is "" and ok is false. |
| 25 | // If you need access to multiple values, use the map directly. |
| 26 | func (args Args) Get(key string) (value string, ok bool) { |
| 27 | if args == nil { |
| 28 | return "", false |
| 29 | } |
| 30 | vals, ok := args[key] |
| 31 | if !ok || len(vals) == 0 { |
| 32 | return "", false |
| 33 | } |
| 34 | return vals[0], true |
| 35 | } |
| 36 | |
| 37 | // Append value to the list of values for key. |
| 38 | func (args Args) Add(key, value string) { |