pipeline

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 5 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearNotificationRegistrations

func ClearNotificationRegistrations()

func ClearRequestRegistrations

func ClearRequestRegistrations()

func Publish

func Publish[TNotification any](ctx context.Context, notification TNotification) error

Publish the notification event to its corresponding notification handler.

func RegisterNotificationHandler

func RegisterNotificationHandler[TEvent any](handler NotificationHandler[TEvent]) error

RegisterNotificationHandler register the notification handler to mediatr registry.

func RegisterNotificationHandlerFactory

func RegisterNotificationHandlerFactory[TEvent any](factory NotificationHandlerFactory[TEvent]) error

RegisterNotificationHandlerFactory register the notification handler factory to mediatr registry.

func RegisterNotificationHandlers

func RegisterNotificationHandlers[TEvent any](handlers ...NotificationHandler[TEvent]) error

RegisterNotificationHandlers register the notification handlers to mediatr registry.

func RegisterNotificationHandlersFactories

func RegisterNotificationHandlersFactories[TEvent any](factories ...NotificationHandlerFactory[TEvent]) error

RegisterNotificationHandlersFactories register the notification handlers factories to mediatr registry.

func RegisterRequestHandler

func RegisterRequestHandler[TRequest any, TResponse any](handler RequestHandler[TRequest, TResponse]) error

RegisterRequestHandler register the request handler to mediatr registry.

func RegisterRequestHandlerFactory

func RegisterRequestHandlerFactory[TRequest any, TResponse any](factory RequestHandlerFactory[TRequest, TResponse]) error

RegisterRequestHandlerFactory register the request handler factory to mediatr registry.

func RegisterRequestPipelineBehaviors

func RegisterRequestPipelineBehaviors(behaviours ...PipelineBehavior) error

RegisterRequestPipelineBehaviors register the request behaviors to mediatr registry.

func Send

func Send[TRequest any, TResponse any](ctx context.Context, request TRequest) (TResponse, error)

Send the request to its corresponding request handler.

Types

type NotificationHandler

type NotificationHandler[TNotification any] interface {
	Handle(ctx context.Context, notification TNotification) error
}

type NotificationHandlerFactory

type NotificationHandlerFactory[TNotification any] func() NotificationHandler[TNotification]

type PipelineBehavior

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

PipelineBehavior is a Pipeline behavior for wrapping the inner handler.

type RequestHandler

type RequestHandler[TRequest any, TResponse any] interface {
	Handle(ctx context.Context, request TRequest) (TResponse, error)
}

type RequestHandlerFactory

type RequestHandlerFactory[TRequest any, TResponse any] func() RequestHandler[TRequest, TResponse]

type RequestHandlerFunc

type RequestHandlerFunc func(ctx context.Context) (interface{}, error)

RequestHandlerFunc is a continuation for the next task to execute in the pipeline

type Unit

type Unit struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL