Thanks to visit codestin.com
Credit goes to pkg.go.dev

middleware

package
v1.0.0-beta.8 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyHandlerMiddleware

ApplyHandlerMiddleware applies a series of middlewares to an inbound message handler function. It takes an inbound message handler function and a variadic list of middlewares as input. Each middleware is applied to the handler function in the order they are provided. The resulting function is returned as the final handler function with all the middlewares applied.

func ApplyPublisherMiddleware

func ApplyPublisherMiddleware(p interfaces.PublisherFunc,
	middlewares ...interfaces.PublisherMiddlewareFunc) interfaces.PublisherFunc

ApplyPublisherMiddleware applies a series of middlewares to a publisher function. It takes a publisher function and a variadic list of publisher middleware functions as input. Each middleware function is applied to the publisher function in the order they are provided. The resulting publisher function is returned.

func HelloWorldMiddlewareExecuteAfterInboundMessageHandler

func HelloWorldMiddlewareExecuteAfterInboundMessageHandler() interfaces.InboundMessageHandlerMiddlewareFunc

HelloWorldMiddlewareExecuteAfterInboundMessageHandler returns an inbound message handler middleware function. This middleware function executes after the inbound message handler and performs additional tasks. It logs any errors that occur during the execution of the next handler and provides an opportunity to handle them. You can customize the error handling logic by adding your own error handler, such as sending errors to Sentry or other error tracking tools. After error handling, it logs a message indicating that the hello-world-last-middleware has been executed. The function signature follows the `interfaces.InboundMessageHandlerMiddlewareFunc` type.

func HelloWorldMiddlewareExecuteAfterPublisher

func HelloWorldMiddlewareExecuteAfterPublisher() interfaces.PublisherMiddlewareFunc

HelloWorldMiddlewareExecuteAfterPublisher is a function that returns a PublisherMiddlewareFunc. It wraps the provided PublisherFunc with additional functionality to be executed after publishing a message.

func HelloWorldMiddlewareExecuteBeforeInboundMessageHandler

func HelloWorldMiddlewareExecuteBeforeInboundMessageHandler() interfaces.InboundMessageHandlerMiddlewareFunc

HelloWorldMiddlewareExecuteBeforeInboundMessageHandler is a function that returns an inbound message handler middleware. This middleware logs a message and then calls the next inbound message handler in the chain.

func HelloWorldMiddlewareExecuteBeforePublisher

func HelloWorldMiddlewareExecuteBeforePublisher() interfaces.PublisherMiddlewareFunc

HelloWorldMiddlewareExecuteBeforePublisher is a function that returns a PublisherMiddlewareFunc. It wraps the provided PublisherFunc with a middleware that logs a message before executing the next middleware or the actual publisher function.

func InboundMessageHandlerDefaultErrorMapper

func InboundMessageHandlerDefaultErrorMapper() interfaces.InboundMessageHandlerMiddlewareFunc

InboundMessageHandlerDefaultErrorMapper returns a middleware function that maps specific errors to predefined error types. It takes the next inbound message handler function as input and returns a new inbound message handler function. The returned function checks if an error occurred during the execution of the next handler function. If an error is found, it maps the error to a predefined error type and returns it. If no error is found, it returns nil.

func PublisherDefaultErrorMapper

func PublisherDefaultErrorMapper() interfaces.PublisherMiddlewareFunc

PublisherDefaultErrorMapper returns a middleware function that maps publisher errors to specific error types. It takes a next PublisherFunc as input and returns a new PublisherFunc that performs error mapping. If an error occurs during publishing, it will be mapped to a specific error type based on the error code. The mapped error will be returned, or nil if no error occurred.

Types

This section is empty.

Jump to

Keyboard shortcuts

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