Skip to content

Commit

Permalink
add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdihadeli committed Sep 24, 2022
1 parent 6d0ab8b commit a32a663
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mediatr.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ package mediatr

import (
"context"

"github.com/ahmetb/go-linq/v3"
"github.com/goccy/go-reflect"
"github.com/pkg/errors"
)

// RequestHandlerFunc is a continuation for the next task to execute in the pipeline
type RequestHandlerFunc func() (interface{}, error)

// PipelineBehavior is a Pipeline behavior for wrapping the inner handler.
type PipelineBehavior interface {
Handle(ctx context.Context, request interface{}, next RequestHandlerFunc) (interface{}, error)
}

type RequestHandler[TRequest any, TResponse any] interface {
Handle(ctx context.Context, request TRequest) (TResponse, error)
}
Expand All @@ -17,10 +24,6 @@ type NotificationHandler[TNotification any] interface {
Handle(ctx context.Context, notification TNotification) error
}

type PipelineBehavior interface {
Handle(ctx context.Context, request interface{}, next RequestHandlerFunc) (interface{}, error)
}

var requestHandlersRegistrations = map[reflect.Type]interface{}{}
var notificationHandlersRegistrations = map[reflect.Type][]interface{}{}
var pipelineBehaviours []interface{} = []interface{}{}
Expand Down

0 comments on commit a32a663

Please sign in to comment.