Skip to content

Commit

Permalink
Add GetRevision() to Event API
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Pimenta <[email protected]>
  • Loading branch information
matheuscscp committed Jan 20, 2025
1 parent 39b14b7 commit a189152
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions apis/event/v1beta1/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,15 @@ func (in *Event) HasMetadata(key string, val string) bool {
}
return false
}

// GetRevision looks up for the MetaOriginRevisionKey and MetaRevisionKey
// keys in the Metadata and returns the first it finds.
func (in *Event) GetRevision() (string, bool) {
if r, ok := in.Metadata[MetaOriginRevisionKey]; ok {
return r, true
}
if r, ok := in.Metadata[MetaRevisionKey]; ok {
return r, true
}
return "", false
}

0 comments on commit a189152

Please sign in to comment.