Documentation ¶
Index ¶
- Constants
- func MethodNotAllowed() http.HandlerFunc
- func NotFound() http.HandlerFunc
- func SetDefaultPagination(filter interface{}, defaultSortBy string) error
- type ContextKey
- type DocumentationConfig
- type Filter
- type HTTP2Config
- type HTTPServer
- func (h *HTTPServer) AddMiddleware(middleware ...gin.HandlerFunc)
- func (h *HTTPServer) BootstrapServer(ctx context.Context, handler http.Handler) error
- func (h *HTTPServer) CopyRequestBody(r *http.Request) ([]byte, error)
- func (h *HTTPServer) ExtractRequestMetadata(r *http.Request) map[string]any
- func (h *HTTPServer) GetCacheRequestBody(r *http.Request) ([]byte, error)
- func (h *HTTPServer) GetCorrelationParams(r *http.Request) *log.CorrelationParam
- func (h *HTTPServer) GetCustomerID(r *http.Request) *log.CustomerIdentifier
- func (h *HTTPServer) GetMaskedRequestMeta(r *http.Request) map[string]any
- func (h *HTTPServer) GetPort() string
- func (h *HTTPServer) GetRequestBody(r *http.Request) ([]byte, error)
- func (h *HTTPServer) GetRouter() *gin.Engine
- func (h *HTTPServer) GetSpanFromContext(ctx context.Context) (span.Span, bool)
- func (h *HTTPServer) HandleExceptionMiddleware() gin.HandlerFunc
- func (h *HTTPServer) HealthCheck(w http.ResponseWriter, r *http.Request)
- func (h *HTTPServer) LoadRequestJSONBody(r *http.Request, body any) error
- func (h *HTTPServer) LogRequestResponseMiddleware() gin.HandlerFunc
- func (h *HTTPServer) Name(ctx context.Context) string
- func (h *HTTPServer) RequestTimerMiddleware() gin.HandlerFunc
- func (h *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *HTTPServer) SetContextMiddleware() gin.HandlerFunc
- func (h *HTTPServer) SetErrorInContext(ctx context.Context, err error)
- func (h *HTTPServer) SetStackTrackInContext(ctx context.Context, stackTrace string)
- func (h *HTTPServer) SetupDocumentation(ctx context.Context)
- func (h *HTTPServer) SetupRouter(ctx context.Context)
- func (h *HTTPServer) Shutdown(ctx context.Context) error
- func (h *HTTPServer) StartH2CServer()
- func (h *HTTPServer) StartServer()
- func (h *HTTPServer) StartTLSServer()
- func (h *HTTPServer) Status(w http.ResponseWriter, r *http.Request)
- func (h *HTTPServer) StatusCheck(ctx context.Context) (any, error)
- func (h *HTTPServer) WriteJSON(ctx context.Context, w http.ResponseWriter, responseBody any)
- func (h *HTTPServer) WriteJSONWithStatusCode(ctx context.Context, w http.ResponseWriter, statusCode int, responseBody any)
- func (h *HTTPServer) WriteResponse(ctx context.Context, w http.ResponseWriter, contentType string, ...)
- func (h *HTTPServer) WriteResponseWithStatusCode(ctx context.Context, w http.ResponseWriter, statusCode int, contentType string, ...)
- type HTTPServerConfig
- type LogConfig
- type Tracer
Constants ¶
View Source
const ( HttpContentTypeJSON = "application/json" HttpHeaderContentType = "Content-Type" ContextKeyRequestBody = ContextKey("ContextKeyRequestBody") ContextKeyHandlerError = ContextKey("ContextKeyHandlerError") ContextKeyHandlerErrorStackTrace = ContextKey("ContextKeyHandlerErrorStackTrace") )
Variables ¶
This section is empty.
Functions ¶
func MethodNotAllowed ¶
func MethodNotAllowed() http.HandlerFunc
func NotFound ¶
func NotFound() http.HandlerFunc
func SetDefaultPagination ¶
Types ¶
type ContextKey ¶
type ContextKey string
type DocumentationConfig ¶
type HTTP2Config ¶
type HTTPServer ¶
func New ¶
func New(appConfig HTTPServerConfig, logger log.Log, tr Tracer, errorNotifier errors.ErrorNotifier) *HTTPServer
func (*HTTPServer) AddMiddleware ¶
func (h *HTTPServer) AddMiddleware(middleware ...gin.HandlerFunc)
func (*HTTPServer) BootstrapServer ¶
func (*HTTPServer) CopyRequestBody ¶
func (h *HTTPServer) CopyRequestBody(r *http.Request) ([]byte, error)
func (*HTTPServer) ExtractRequestMetadata ¶
func (h *HTTPServer) ExtractRequestMetadata(r *http.Request) map[string]any
func (*HTTPServer) GetCacheRequestBody ¶
func (h *HTTPServer) GetCacheRequestBody(r *http.Request) ([]byte, error)
func (*HTTPServer) GetCorrelationParams ¶
func (h *HTTPServer) GetCorrelationParams(r *http.Request) *log.CorrelationParam
func (*HTTPServer) GetCustomerID ¶
func (h *HTTPServer) GetCustomerID(r *http.Request) *log.CustomerIdentifier
func (*HTTPServer) GetMaskedRequestMeta ¶
func (h *HTTPServer) GetMaskedRequestMeta(r *http.Request) map[string]any
func (*HTTPServer) GetPort ¶
func (h *HTTPServer) GetPort() string
func (*HTTPServer) GetRequestBody ¶
func (h *HTTPServer) GetRequestBody(r *http.Request) ([]byte, error)
func (*HTTPServer) GetRouter ¶
func (h *HTTPServer) GetRouter() *gin.Engine
func (*HTTPServer) GetSpanFromContext ¶
func (*HTTPServer) HandleExceptionMiddleware ¶
func (h *HTTPServer) HandleExceptionMiddleware() gin.HandlerFunc
func (*HTTPServer) HealthCheck ¶
func (h *HTTPServer) HealthCheck(w http.ResponseWriter, r *http.Request)
func (*HTTPServer) LoadRequestJSONBody ¶
func (h *HTTPServer) LoadRequestJSONBody(r *http.Request, body any) error
func (*HTTPServer) LogRequestResponseMiddleware ¶
func (h *HTTPServer) LogRequestResponseMiddleware() gin.HandlerFunc
func (*HTTPServer) RequestTimerMiddleware ¶
func (h *HTTPServer) RequestTimerMiddleware() gin.HandlerFunc
func (*HTTPServer) ServeHTTP ¶
func (h *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*HTTPServer) SetContextMiddleware ¶
func (h *HTTPServer) SetContextMiddleware() gin.HandlerFunc
func (*HTTPServer) SetErrorInContext ¶
func (h *HTTPServer) SetErrorInContext(ctx context.Context, err error)
func (*HTTPServer) SetStackTrackInContext ¶
func (h *HTTPServer) SetStackTrackInContext(ctx context.Context, stackTrace string)
func (*HTTPServer) SetupDocumentation ¶
func (h *HTTPServer) SetupDocumentation(ctx context.Context)
func (*HTTPServer) SetupRouter ¶
func (h *HTTPServer) SetupRouter(ctx context.Context)
func (*HTTPServer) StartH2CServer ¶
func (h *HTTPServer) StartH2CServer()
func (*HTTPServer) StartServer ¶
func (h *HTTPServer) StartServer()
func (*HTTPServer) StartTLSServer ¶
func (h *HTTPServer) StartTLSServer()
func (*HTTPServer) Status ¶
func (h *HTTPServer) Status(w http.ResponseWriter, r *http.Request)
func (*HTTPServer) StatusCheck ¶
func (h *HTTPServer) StatusCheck(ctx context.Context) (any, error)
func (*HTTPServer) WriteJSON ¶
func (h *HTTPServer) WriteJSON(ctx context.Context, w http.ResponseWriter, responseBody any)
func (*HTTPServer) WriteJSONWithStatusCode ¶
func (h *HTTPServer) WriteJSONWithStatusCode(ctx context.Context, w http.ResponseWriter, statusCode int, responseBody any)
func (*HTTPServer) WriteResponse ¶
func (h *HTTPServer) WriteResponse(ctx context.Context, w http.ResponseWriter, contentType string, responseBody []byte)
func (*HTTPServer) WriteResponseWithStatusCode ¶
func (h *HTTPServer) WriteResponseWithStatusCode(ctx context.Context, w http.ResponseWriter, statusCode int, contentType string, responseBody []byte)
type HTTPServerConfig ¶
type HTTPServerConfig struct { baseapp.ServerConfig DocumentationConfig *HTTP2Config Host string Port string Log *LogConfig }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.