Documentation
¶
Index ¶
- Constants
- Variables
- func ErrorsMiddleware(ctx context.Context, descriptor Descriptor, headers *Headers, msg any, ...) error
- func LoggingMiddleware(ctx context.Context, descriptor Descriptor, headers *Headers, msg any, ...) error
- func RecoveryMiddleware(ctx context.Context, descriptor Descriptor, headers *Headers, msg any, ...) error
- type Descriptor
- type HandleFn
- type HandlerOption
- type Headers
- type Manager
- type Message
- type Middleware
- type Option
- type Router
- type StatusCode
Constants ¶
View Source
const ( DefaultShutdownTimeout = 10 * time.Second DefaultShutdownHandler = true )
Variables ¶
View Source
var ( MapErrStatusCode = map[error]StatusCode{ errors.ErrValidation: StatusInvalidArgument, errors.ErrMalformed: StatusMalformed, errors.ErrUnauthenticated: StatusUnauthenticated, errors.ErrPermissionDenied: StatusPermissionDenied, errors.ErrNotFound: StatusNotFound, errors.ErrAlreadyExists: StatusAlreadyExists, errors.ErrConflict: StatusConflict, errors.ErrFailedPrecondition: StatusFailedPrecondition, errors.ErrResourceExhausted: StatusResourceExhausted, errors.ErrDeadlineExceeded: StatusDeadlineExceeded, errors.ErrCanceled: StatusCanceled, errors.ErrUnavailable: StatusUnavailable, errors.ErrAborted: StatusAborted, errors.ErrInternal: StatusInternalError, } )
Functions ¶
func ErrorsMiddleware ¶
func LoggingMiddleware ¶
func RecoveryMiddleware ¶
Types ¶
type Descriptor ¶
type HandlerOption ¶
type HandlerOption func(*handlerConfig) error
func WithDescriptor ¶
func WithDescriptor(descriptor Descriptor) HandlerOption
func WithHandler ¶
func WithMiddlewares ¶
func WithMiddlewares(middlewares ...Middleware) HandlerOption
type Manager ¶
type Middleware ¶
type Option ¶
type Option func(*manager) error
func WithPublisher ¶
func WithShutdownTimeout ¶
func WithSubscriber ¶
func WithSubscriber(subscriber message.Subscriber) Option
func WithoutShutdownHandler ¶
func WithoutShutdownHandler() Option
type Router ¶
type Router interface {
Channel() string
WithMiddlewares(middlewares ...Middleware) *router
RegisterHandler(opts ...HandlerOption) error
// contains filtered or unexported methods
}
type StatusCode ¶
type StatusCode int
StatusCode represents an messaging status code.
const ( StatusOK StatusCode = iota StatusInvalidArgument StatusMalformed StatusUnauthenticated StatusPermissionDenied StatusNotFound StatusAlreadyExists StatusConflict StatusFailedPrecondition StatusResourceExhausted StatusDeadlineExceeded StatusCanceled StatusAborted StatusInternalError )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.