File size: 587 Bytes
fea99b3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | package operation_test
import (
"context"
"github.com/openmeterio/openmeter/pkg/framework/operation"
)
func mw1[Request any, Response any](next operation.Operation[Request, Response]) operation.Operation[Request, Response] {
return func(ctx context.Context, request Request) (Response, error) {
return next(ctx, request)
}
}
func mwchain[Request any, Response any](op operation.Operation[Request, Response]) operation.Operation[Request, Response] {
chain := operation.Chain[Request, Response](mw1)
return chain(op)
}
func ExampleMiddleware() {
mwchain(exampleOperation)
}
|