package
0.24.0
Repository: https://github.com/lushdigital/core.git
Documentation: pkg.go.dev

# README

Middleware

The core/middleware package is used to interact with HTTP & gRPC middlewares.

Middlewares

Examples

Chain gRPC middlewares

server = grpcsrv.New(nil, middleware.WithUnaryServerChain(
    metricsmw.UnaryServerInterceptor,
    tracingmw.UnaryServerInterceptor,
    paginationmw.UnaryServerInterceptor,
))

# Packages

Package i18nmw provides transport middlewares for dealing with internationalisation.
Package metricsmw is used to record and expose metrics for an application.
Package paginationmw provides transport middlewares for dealing with pagination.
Package tracingmw allows setting and tracing a request by injecting an id as part of it's headers, when dealing with HTTP, or it's context, when dealing with GRPC.

# Functions

ChainStreamClient creates a single interceptor out of a chain of many interceptors.
ChainStreamServer creates a single interceptor out of a chain of many interceptors.
ChainUnaryClient creates a single interceptor out of a chain of many interceptors.
ChainUnaryServer creates a single interceptor out of a chain of many interceptors.
WithStreamServerChain is a grpc.Server config option that accepts multiple stream interceptors.
WithUnaryServerChain is a grpc.Server config option that accepts multiple unary interceptors.
WrapServerStream returns a ServerStream that has the ability to overwrite context.

# Structs

WrappedServerStream is a thin wrapper around grpc.ServerStream that allows modifying context.