Documentation ¶
Index ¶
- Variables
- func AsynqCompensatorMiddleware(options ...CompensatorAsynqMiddlewareOpt) tricks.Middleware[asynq.Handler]
- func AsynqErrorDecoratorMiddleware(options ...ErrorDecoratorAsynqMiddlewareOpt) tricks.Middleware[asynq.Handler]
- func AsynqOpenTelemetryMiddleware(tracer trace.Tracer, options ...OpenTelemetryAsynqMiddlewareOpt) tricks.Middleware[asynq.Handler]
- func AsynqPanicRecoverMiddleware(options ...PanicRecoverAsynqMiddlewareOpt) tricks.Middleware[asynq.Handler]
- func BricksErrorToHttpStatusMapper(err error) int
- func BricksToGrpcErrorMapper(err error) error
- func GrpcOpenTelemetryMiddleware(tracer trace.Tracer, options ...OpenTelemetryGrpcMiddlewareOpt) tricks.Middleware[grpc.UnaryServerInterceptor]
- func GrpcPanicRecoverMiddleware(options ...PanicRecoverGrpcMiddlewareOpt) tricks.Middleware[grpc.UnaryServerInterceptor]
- func GrpcToBricksErrorMapper(err error) error
- func GrpcUnaryClientErrorMapperMiddleware(mapper func(error) error) tricks.Middleware[grpc.UnaryClientInterceptor]
- func GrpcUnaryClientInvokerInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, ...) error
- func GrpcUnaryServerErrorMapperMiddleware(mapper func(error) error) tricks.Middleware[grpc.UnaryServerInterceptor]
- func GrpcUnaryServerInvokeHandlerInterceptor(ctx context.Context, req any, _ *grpc.UnaryServerInfo, ...) (any, error)
- func HttpBlindLoggerMiddleware(mctx *middleware.Context, options ...BlindLoggerHttpMiddlewareOpt) tricks.Middleware[http.Handler]
- func HttpBlindLoggerTripperware(options ...BlindLoggerHttpTripperwareOpt) tricks.Middleware[http.RoundTripper]
- func HttpCrossOriginResourceSharingPolicyMiddleware(options ...CorsHttpMiddlewareOpt) tricks.Middleware[http.Handler]
- func HttpErrorMapperTripperware(mapper func(*http.Response, error) (*http.Response, error)) tricks.Middleware[http.RoundTripper]
- func HttpOpenTelemetryMiddleware(tracer trace.Tracer, mctx *middleware.Context, ...) tricks.Middleware[http.Handler]
- func HttpPanicRecoverMiddleware(options ...PanicRecoverHttpMiddlewareOpt) tricks.Middleware[http.Handler]
- func HttpStatusToBricksError(code int, err error) error
- func HttpToBricksErrorMapper(rsp *http.Response, err error) (*http.Response, error)
- func NatsCompensatorMiddleware(options ...CompensatorNatsMiddlewareOpt) tricks.Middleware[NatsMsgHandler]
- func NatsOpenTelemetryMiddleware(tracer trace.Tracer, options ...OpenTelemetryNatsMiddlewareOpt) tricks.Middleware[NatsMsgHandler]
- func NatsPanicRecoverMiddleware(options ...PanicRecoverAsynqMiddlewareOpt) tricks.Middleware[NatsMsgHandler]
- type AsynqMiddlewareStack
- type BlindLoggerHttpMiddlewareOpt
- type BlindLoggerHttpTripperwareOpt
- type CompensatorAsynqMiddlewareOpt
- type CompensatorNatsMiddlewareOpt
- type CorsHttpMiddlewareOpt
- type ErrorDecoratorAsynqMiddlewareOpt
- type GrpcUnaryClientMiddlewareStack
- type GrpcUnaryServerMiddlewareStack
- type HttpMiddlewareStack
- type HttpRoundTripperFunc
- type HttpRouteTester
- type HttpTripperwareStack
- type NatsMiddlewareStack
- type NatsMsgHandler
- type OpenTelemetryAsynqMiddlewareOpt
- type OpenTelemetryGrpcMiddlewareOpt
- type OpenTelemetryHttpMiddlewareOpt
- type OpenTelemetryNatsMiddlewareOpt
- type OtelAmw
- type OtelGmw
- type OtelHmw
- type OtelNmw
- type PanicRecoverAsynqMiddlewareOpt
- type PanicRecoverGrpcMiddlewareOpt
- type PanicRecoverHttpMiddlewareOpt
- type PanicRecoverNatsMiddlewareOpt
Constants ¶
This section is empty.
Variables ¶
View Source
var CorsAllowHeaders = func(headers ...string) CorsHttpMiddlewareOpt { return func(s *cors.Options) { s.AllowedHeaders = headers } }
View Source
var CorsAllowMethods = func(methods ...string) CorsHttpMiddlewareOpt { return func(s *cors.Options) { s.AllowedMethods = methods } }
View Source
var CorsAllowOrigins = func(origins ...string) CorsHttpMiddlewareOpt { return func(s *cors.Options) { s.AllowedOrigins = origins } }
View Source
var CorsDebug = func(debug bool) CorsHttpMiddlewareOpt { return func(s *cors.Options) { s.Debug = debug } }
Functions ¶
func AsynqCompensatorMiddleware ¶ added in v0.2.5
func AsynqCompensatorMiddleware(options ...CompensatorAsynqMiddlewareOpt) tricks.Middleware[asynq.Handler]
AsynqCompensatorMiddleware tries to compensate the task if max retries reached or error is not bricks.ErrRetryable. It searches for a bricks.Compensator in returned error by task handler and runs the first one.
func AsynqErrorDecoratorMiddleware ¶ added in v0.2.5
func AsynqErrorDecoratorMiddleware(options ...ErrorDecoratorAsynqMiddlewareOpt) tricks.Middleware[asynq.Handler]
AsynqErrorDecoratorMiddleware skip asynq retry except that error is bricks.ErrRetryable
func AsynqOpenTelemetryMiddleware ¶ added in v0.2.0
func AsynqOpenTelemetryMiddleware( tracer trace.Tracer, options ...OpenTelemetryAsynqMiddlewareOpt, ) tricks.Middleware[asynq.Handler]
func AsynqPanicRecoverMiddleware ¶ added in v0.2.0
func AsynqPanicRecoverMiddleware(options ...PanicRecoverAsynqMiddlewareOpt) tricks.Middleware[asynq.Handler]
func BricksErrorToHttpStatusMapper ¶ added in v0.2.3
func BricksToGrpcErrorMapper ¶ added in v0.2.2
func GrpcOpenTelemetryMiddleware ¶ added in v0.3.0
func GrpcOpenTelemetryMiddleware( tracer trace.Tracer, options ...OpenTelemetryGrpcMiddlewareOpt, ) tricks.Middleware[grpc.UnaryServerInterceptor]
func GrpcPanicRecoverMiddleware ¶ added in v0.3.0
func GrpcPanicRecoverMiddleware( options ...PanicRecoverGrpcMiddlewareOpt, ) tricks.Middleware[grpc.UnaryServerInterceptor]
func GrpcToBricksErrorMapper ¶ added in v0.2.3
func GrpcUnaryClientErrorMapperMiddleware ¶ added in v0.2.3
func GrpcUnaryClientErrorMapperMiddleware(mapper func(error) error) tricks.Middleware[grpc.UnaryClientInterceptor]
func GrpcUnaryClientInvokerInterceptor ¶ added in v0.2.3
func GrpcUnaryClientInvokerInterceptor( ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption, ) error
func GrpcUnaryServerErrorMapperMiddleware ¶ added in v0.2.2
func GrpcUnaryServerErrorMapperMiddleware(mapper func(error) error) tricks.Middleware[grpc.UnaryServerInterceptor]
func GrpcUnaryServerInvokeHandlerInterceptor ¶ added in v0.2.2
func GrpcUnaryServerInvokeHandlerInterceptor( ctx context.Context, req any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (any, error)
func HttpBlindLoggerMiddleware ¶ added in v0.2.0
func HttpBlindLoggerMiddleware( mctx *middleware.Context, options ...BlindLoggerHttpMiddlewareOpt, ) tricks.Middleware[http.Handler]
func HttpBlindLoggerTripperware ¶ added in v0.2.1
func HttpBlindLoggerTripperware(options ...BlindLoggerHttpTripperwareOpt) tricks.Middleware[http.RoundTripper]
func HttpCrossOriginResourceSharingPolicyMiddleware ¶ added in v0.2.0
func HttpCrossOriginResourceSharingPolicyMiddleware(options ...CorsHttpMiddlewareOpt) tricks.Middleware[http.Handler]
func HttpErrorMapperTripperware ¶ added in v0.2.0
func HttpErrorMapperTripperware( mapper func(*http.Response, error) (*http.Response, error), ) tricks.Middleware[http.RoundTripper]
func HttpOpenTelemetryMiddleware ¶ added in v0.2.0
func HttpOpenTelemetryMiddleware( tracer trace.Tracer, mctx *middleware.Context, options ...OpenTelemetryHttpMiddlewareOpt, ) tricks.Middleware[http.Handler]
func HttpPanicRecoverMiddleware ¶ added in v0.2.0
func HttpPanicRecoverMiddleware(options ...PanicRecoverHttpMiddlewareOpt) tricks.Middleware[http.Handler]
func HttpStatusToBricksError ¶ added in v0.5.0
func HttpToBricksErrorMapper ¶ added in v0.2.0
func NatsCompensatorMiddleware ¶ added in v0.4.0
func NatsCompensatorMiddleware(options ...CompensatorNatsMiddlewareOpt) tricks.Middleware[NatsMsgHandler]
NatsCompensatorMiddleware tries to compensate the task if error is not bricks.ErrRetryable. It searches for a bricks.Compensator in returned error by msg handler and runs the first one.
func NatsOpenTelemetryMiddleware ¶ added in v0.4.0
func NatsOpenTelemetryMiddleware( tracer trace.Tracer, options ...OpenTelemetryNatsMiddlewareOpt, ) tricks.Middleware[NatsMsgHandler]
func NatsPanicRecoverMiddleware ¶ added in v0.4.0
func NatsPanicRecoverMiddleware(options ...PanicRecoverAsynqMiddlewareOpt) tricks.Middleware[NatsMsgHandler]
Types ¶
type AsynqMiddlewareStack ¶ added in v0.1.0
type AsynqMiddlewareStack = tricks.MiddlewareStack[asynq.Handler]
type BlindLoggerHttpMiddlewareOpt ¶
type BlindLoggerHttpMiddlewareOpt = tricks.InPlaceOption[any]
type BlindLoggerHttpTripperwareOpt ¶ added in v0.2.1
type BlindLoggerHttpTripperwareOpt = tricks.InPlaceOption[any]
type CompensatorAsynqMiddlewareOpt ¶ added in v0.2.5
type CompensatorAsynqMiddlewareOpt = tricks.InPlaceOption[any]
type CompensatorNatsMiddlewareOpt ¶ added in v0.4.0
type CompensatorNatsMiddlewareOpt = tricks.InPlaceOption[any]
type CorsHttpMiddlewareOpt ¶
type CorsHttpMiddlewareOpt = tricks.InPlaceOption[cors.Options]
type ErrorDecoratorAsynqMiddlewareOpt ¶ added in v0.2.5
type ErrorDecoratorAsynqMiddlewareOpt = tricks.InPlaceOption[any]
type GrpcUnaryClientMiddlewareStack ¶ added in v0.2.3
type GrpcUnaryClientMiddlewareStack = tricks.MiddlewareStack[grpc.UnaryClientInterceptor]
type GrpcUnaryServerMiddlewareStack ¶ added in v0.2.2
type GrpcUnaryServerMiddlewareStack = tricks.MiddlewareStack[grpc.UnaryServerInterceptor]
type HttpMiddlewareStack ¶
type HttpMiddlewareStack = tricks.MiddlewareStack[http.Handler]
type HttpRoundTripperFunc ¶ added in v0.2.0
type HttpRouteTester ¶ added in v0.0.6
type HttpRouteTester func(route *middleware.MatchedRoute) bool
func CombineHttpRouteTesters ¶ added in v0.0.6
func CombineHttpRouteTesters(tt ...HttpRouteTester) HttpRouteTester
func PassthroughHttpRouteTester ¶ added in v0.0.6
func PassthroughHttpRouteTester(success bool) HttpRouteTester
type HttpTripperwareStack ¶ added in v0.2.0
type HttpTripperwareStack = tricks.MiddlewareStack[http.RoundTripper]
type NatsMiddlewareStack ¶ added in v0.4.0
type NatsMiddlewareStack = tricks.MiddlewareStack[NatsMsgHandler]
type NatsMsgHandler ¶ added in v0.4.0
type OpenTelemetryAsynqMiddlewareOpt ¶ added in v0.1.0
func OtelAsynqSpanNamePrefix ¶ added in v0.1.0
func OtelAsynqSpanNamePrefix(prefix string) OpenTelemetryAsynqMiddlewareOpt
type OpenTelemetryGrpcMiddlewareOpt ¶ added in v0.3.0
func OtelGrpcSpanNamePrefix ¶ added in v0.3.0
func OtelGrpcSpanNamePrefix(prefix string) OpenTelemetryGrpcMiddlewareOpt
type OpenTelemetryHttpMiddlewareOpt ¶ added in v0.0.4
func OtelHttpOperationIdException ¶ added in v0.0.6
func OtelHttpOperationIdException(oids ...string) OpenTelemetryHttpMiddlewareOpt
func OtelHttpRouteTester ¶ added in v0.0.6
func OtelHttpRouteTester(tester HttpRouteTester) OpenTelemetryHttpMiddlewareOpt
func OtelHttpSpanNamePrefix ¶ added in v0.0.6
func OtelHttpSpanNamePrefix(prefix string) OpenTelemetryHttpMiddlewareOpt
type OpenTelemetryNatsMiddlewareOpt ¶ added in v0.4.0
func OtelNatsSpanNamePrefix ¶ added in v0.4.0
func OtelNatsSpanNamePrefix(prefix string) OpenTelemetryNatsMiddlewareOpt
type PanicRecoverAsynqMiddlewareOpt ¶ added in v0.1.0
type PanicRecoverAsynqMiddlewareOpt = tricks.InPlaceOption[any]
type PanicRecoverGrpcMiddlewareOpt ¶ added in v0.3.0
type PanicRecoverGrpcMiddlewareOpt = tricks.InPlaceOption[any]
type PanicRecoverHttpMiddlewareOpt ¶
type PanicRecoverHttpMiddlewareOpt = tricks.InPlaceOption[any]
type PanicRecoverNatsMiddlewareOpt ¶ added in v0.4.0
type PanicRecoverNatsMiddlewareOpt = tricks.InPlaceOption[any]
Click to show internal directories.
Click to hide internal directories.