middleware

package
v0.0.0-...-54e8470 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTracePropagator

func NewTracePropagator() propagation.TextMapPropagator

NewTracePropagator creates a new propagator.

func WithRecover

func WithRecover() connect.HandlerOption

WithRecover recovers the handler from any panic.

func WithTracer

func WithTracer() connect.Interceptor

WithTracer set up the Open Telemetry Tracer.

func WithValidator

func WithValidator() connect.Interceptor

WithValidator set up the request validator

Types

type ResponseWriter

type ResponseWriter struct {
	StatusCode     int32
	ContentLength  int64
	ResponseWriter http.ResponseWriter
}

ResponseWriter repersents a response writer.

func (*ResponseWriter) Flush

func (r *ResponseWriter) Flush()

Flush implements http.Flusher.

func (*ResponseWriter) GetContentLength

func (r *ResponseWriter) GetContentLength() int64

GetContentLength returns the ContentLength.

func (*ResponseWriter) GetStatusCode

func (r *ResponseWriter) GetStatusCode() int32

GetStatusCode returns the StatusCode.

func (*ResponseWriter) Header

func (r *ResponseWriter) Header() http.Header

Header implements http.ResponseWriter

func (*ResponseWriter) Write

func (r *ResponseWriter) Write(data []byte) (int, error)

Write implements http.ResponseWriter

func (*ResponseWriter) WriteHeader

func (r *ResponseWriter) WriteHeader(code int)

WriteHeader implements http.ResponseWriter

type TracePropagator

type TracePropagator struct{}

TracePropagator implements propagation.TracePropagator to propagate traces in HTTP headers for Google Cloud Platform and Stackdriver Trace.

func (TracePropagator) Extract

Extract returns the context from a given carrier.

func (TracePropagator) Fields

func (f TracePropagator) Fields() []string

func (TracePropagator) Inject

func (f TracePropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier)

Inject injects the span into a given carrier.

type UnaryHandlerFunc

type UnaryHandlerFunc = func(http.Handler) http.Handler

UnaryHandlerFunc represent the handler.

func WithUnaryHandler

func WithUnaryHandler(collection []connect.Interceptor) UnaryHandlerFunc

WithUnaryHandler represents an unary handler

type UnaryInterceptor

type UnaryInterceptor struct {
	UnaryHandler     UnaryHandlerFunc
	UnaryInterceptor UnaryInterceptorFunc
}

UnaryInterceptor represents an unary handler.

func WithLogger

func WithLogger() *UnaryInterceptor

WithLogger set up the logger.

func (*UnaryInterceptor) WrapStreamingClient

func (x *UnaryInterceptor) WrapStreamingClient(fn connect.StreamingClientFunc) connect.StreamingClientFunc

WrapStreamingClient implements connect.Interceptor

func (*UnaryInterceptor) WrapStreamingHandler

func (x *UnaryInterceptor) WrapStreamingHandler(fn connect.StreamingHandlerFunc) connect.StreamingHandlerFunc

WrapStreamingHandler implements connect.Interceptor

func (*UnaryInterceptor) WrapUnary

func (x *UnaryInterceptor) WrapUnary(fn connect.UnaryFunc) connect.UnaryFunc

WrapUnary implements connect.Interceptor

func (*UnaryInterceptor) WrapUnaryHandler

func (x *UnaryInterceptor) WrapUnaryHandler(fn http.Handler) http.Handler

WrapUnaryHandler implements UnaryHandlerFunc.

type UnaryInterceptorFunc

type UnaryInterceptorFunc = connect.UnaryInterceptorFunc

UnaryInterceptorFunc is a simple Interceptor implementation that only wraps unary RPCs. It has no effect on streaming RPCs.

Jump to

Keyboard shortcuts

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