Skip to content

Commit

Permalink
Update Event interface code doc (#825)
Browse files Browse the repository at this point in the history
The `Event` interface is implemented by all events. The code docs were not clear on how a consumer leverages the `Event` interface to handle the event (for example transport the event).

This code doc clarifies the intended usage of the Event interface.
  • Loading branch information
mergify[bot] authored Nov 2, 2023
2 parents 809f2c0 + 946b93c commit c3fe06a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/agent/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ import "context"
// Name is a unique name identifying an event.
type Name string

// Event is a recordable event.
// Event is an event generated during execution of a Workflow. Each event in the event package
// implements this interface. Consumers may type switch the Event to the appropriate type for
// event handling.
//
// E.g.
//
// switch ev.(type) {
// case event.ActionStarted:
// // Handle ActionStarted event.
// default:
// // Unsupported event.
// }
type Event interface {
// GetName retrieves the event name.
GetName() Name
Expand Down

0 comments on commit c3fe06a

Please sign in to comment.