openmeter / pkg /framework /operation /middleware_test.go
Leon4gr45's picture
Upload folder using huggingface_hub (part 9)
fea99b3 verified
Raw
History Blame Contribute Delete
587 Bytes
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)
}