Filter creates a copy of Meta with only the specified keys.
(only ...string)
| 18 | |
| 19 | // Filter creates a copy of Meta with only the specified keys. |
| 20 | func (m Meta) Filter(only ...string) Meta { |
| 21 | filtered := make(Meta) |
| 22 | for _, key := range only { |
| 23 | if value, ok := m[key]; ok { |
| 24 | filtered[key] = value |
| 25 | } |
| 26 | } |
| 27 | return filtered |
| 28 | } |
| 29 | |
| 30 | // MetaKey formats a metadata key with the standard prefix. |
| 31 | func MetaKey(key string) string { |
no outgoing calls