Skip to content

Commit 9be3029

Browse files
authored
Expose API to get operations from the Service (#22)
Add `Service.GetOperation` to be able to get an operation by its name.
1 parent 7629453 commit 9be3029

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: nexus/operation.go

+5
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ func (s *Service) Register(operations ...RegisterableOperation) error {
166166
return nil
167167
}
168168

169+
// Operation returns an operation by name or nil if not found.
170+
func (s *Service) Operation(name string) RegisterableOperation {
171+
return s.operations[name]
172+
}
173+
169174
// A ServiceRegistry registers services and constructs a [Handler] that dispatches operations requests to those services.
170175
type ServiceRegistry struct {
171176
services map[string]*Service

0 commit comments

Comments
 (0)