Skip to content

Commit

Permalink
Simplify GetMetaStringValue.
Browse files Browse the repository at this point in the history
  • Loading branch information
bestpath-gb committed May 5, 2020
1 parent 140e74f commit d084e89
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions libbeat/beat/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ func (e *Event) SetID(id string) {
}

func (e *Event) GetMetaStringValue(key string) (string, error) {
var val string
if tmp, err := e.GetValue("@metadata." + key); err == nil {
if s, ok := tmp.(string); ok {
return s, nil
} else {
return val, err
}
} else {
return val, err
tmp, err := e.Meta.GetValue(key)
if err != nil {
return "", err
}

if s, ok := tmp.(string); ok {
return s, nil
}

return "", nil
}

func (e *Event) GetValue(key string) (interface{}, error) {
Expand Down

0 comments on commit d084e89

Please sign in to comment.