Skip to content

Commit cb760d1

Browse files
Add experimental tags
1 parent d1f86a6 commit cb760d1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

nexus/operation.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
type NoValue *struct{}
1717

1818
// OperationOptions contains the general options for an operation, across different handlers.
19+
//
20+
// NOTE: Experimental
1921
type OperationOptions struct {
2022
// ServiceName is the name of the service that contains the operation.
2123
ServiceName string
@@ -32,6 +34,10 @@ type OperationOptions struct {
3234
Header Header
3335
}
3436

37+
// MiddlewareFunc is a function which receives an OperationInvoker and returns another OperationInvoker.
38+
// If the middleware wants to stop the chain before any handler is called, it can return an error.
39+
//
40+
// NOTE: Experimental
3541
type MiddlewareFunc func(OperationOptions, OperationInvoker[any, any]) (OperationInvoker[any, any], error)
3642

3743
// OperationReference provides a typed interface for invoking operations. Every [Operation] is also an
@@ -241,6 +247,8 @@ func (r *ServiceRegistry) Register(services ...*Service) error {
241247
}
242248

243249
// Use registers middleware to be applied to all operations. Middleware is called for each operation invocation.
250+
//
251+
// NOTE: Experimental
244252
func (s *ServiceRegistry) Use(middleWare ...MiddlewareFunc) {
245253
s.middleware = append(s.middleware, middleWare...)
246254
}

0 commit comments

Comments
 (0)