Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a query for getting the latest event of type #32

Merged
merged 1 commit into from
Apr 15, 2024
Merged

Conversation

billyb2
Copy link
Contributor

@billyb2 billyb2 commented Apr 5, 2024

No description provided.

@billyb2 billyb2 requested a review from benbjohnson April 5, 2024 17:50
Comment on lines +165 to +173
func (m *Machine) GetLatestEventOfType(eventType string) *MachineEvent {
for _, event := range m.Events {
if event.Type == eventType {
return event
}
}
return nil
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume m.Events is always ordered by time descending?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, i checked w Dov. We also make that assumption in GetlatestEventOfTypeAfterType

@billyb2 billyb2 merged commit 0e5dc56 into main Apr 15, 2024
5 checks passed
@billyb2 billyb2 deleted the event_type_query branch April 15, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants