Documentation
¶
Index ¶
- func BuildContextWithNamespace(ctx context.Context, ns *namespace.Namespace) context.Context
- func ChainUnaryInterceptors(interceptors ...connect.UnaryInterceptorFunc) connect.Option
- func ErrorResponse() connect.UnaryInterceptorFunc
- func FetchNamespaceFromContext(ctx context.Context) *namespace.Namespace
- func Logger() connect.UnaryInterceptorFunc
- func Namespace(service NamespaceService, namespaceClaimKey, userUUIDHeaderKey string) connect.UnaryInterceptorFunc
- func Recovery() connect.UnaryInterceptorFunc
- func UserHeaderCtx(identityHeaderKeyUUID, identityHeaderKeyEmail string) connect.UnaryInterceptorFunc
- type NamespaceKey
- type NamespaceService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildContextWithNamespace ¶
BuildContextWithNamespace stores the namespace in context.
func ChainUnaryInterceptors ¶
func ChainUnaryInterceptors(interceptors ...connect.UnaryInterceptorFunc) connect.Option
ChainUnaryInterceptors chains multiple unary interceptors into a single interceptor.
func ErrorResponse ¶
func ErrorResponse() connect.UnaryInterceptorFunc
ErrorResponse returns a new unary interceptor that standardizes error formatting. It ensures all errors returned from handlers are proper Connect errors. Non-Connect errors are sanitized to prevent leaking internal details.
func FetchNamespaceFromContext ¶
FetchNamespaceFromContext retrieves namespace from context, returns default if not found.
func Logger ¶
func Logger() connect.UnaryInterceptorFunc
Logger returns a new unary interceptor that logs request details.
func Namespace ¶
func Namespace(service NamespaceService, namespaceClaimKey, userUUIDHeaderKey string) connect.UnaryInterceptorFunc
Namespace returns a new unary interceptor that extracts namespace from: 1. JWT token (priority 1) - uses namespaceClaimKey 2. x-namespace header (priority 2) 3. Defaults to DefaultNamespace
func Recovery ¶
func Recovery() connect.UnaryInterceptorFunc
Recovery returns a new unary interceptor that recovers from panics.
func UserHeaderCtx ¶
func UserHeaderCtx(identityHeaderKeyUUID, identityHeaderKeyEmail string) connect.UnaryInterceptorFunc
UserHeaderCtx returns a new unary interceptor that propagates a valid user ID from request headers within the request context. Use `user.FromContext` function to get the user.
Types ¶
type NamespaceKey ¶
type NamespaceKey struct{}
NamespaceKey is injected in context with the tenant context