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:
parent
460c98d92d
commit
488fe61354
1 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue