Documentation ¶
Overview ¶
Package connecthelper provides helper functions for connectRPC.
Index ¶
- func SDKTypeAndVersion(header http.Header) (string, string)
- func ToRPCCodeString(err error) string
- func ToStatusError(err error) error
- type LoggingInterceptor
- func (i *LoggingInterceptor) WrapStreamingClient(next connect.StreamingClientFunc) connect.StreamingClientFunc
- func (i *LoggingInterceptor) WrapStreamingHandler(next connect.StreamingHandlerFunc) connect.StreamingHandlerFunc
- func (i *LoggingInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SDKTypeAndVersion ¶
SDKTypeAndVersion returns the type and version of the SDK from the given metadata.
func ToRPCCodeString ¶
ToRPCCodeString returns a string representation of the given error.
func ToStatusError ¶
ToStatusError returns a connect.Error from the given logic error. If an error occurs while executing logic in API handler, connectRPC connect.error should be returned so that the client can know more about the status of the request.
Types ¶
type LoggingInterceptor ¶
type LoggingInterceptor struct {
// contains filtered or unexported fields
}
LoggingInterceptor is an interceptor for request logging.
func NewLoggingInterceptor ¶
func NewLoggingInterceptor() *LoggingInterceptor
NewLoggingInterceptor creates a new instance of LoggingInterceptor.
func (*LoggingInterceptor) WrapStreamingClient ¶
func (i *LoggingInterceptor) WrapStreamingClient(next connect.StreamingClientFunc) connect.StreamingClientFunc
WrapStreamingClient creates a stream client interceptor for request logging.
func (*LoggingInterceptor) WrapStreamingHandler ¶
func (i *LoggingInterceptor) WrapStreamingHandler(next connect.StreamingHandlerFunc) connect.StreamingHandlerFunc
WrapStreamingHandler creates a stream server interceptor for request logging.