1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

beam/data: convenience Message.Get

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
Solomon Hykes 2014-03-24 18:16:27 -07:00
parent 460c98d92d
commit 488fe61354

View file

@ -42,6 +42,18 @@ func (m Message) Del(k string) Message {
return Message(Encode(data))
}
func (m Message) Get(k string) []string {
data, err := Decode(string(m))
if err != nil {
return nil
}
v, exists := data[k]
if !exists {
return nil
}
return v
}
func (m Message) String() string {
return string(m)
}