package
0.0.25
Repository: https://github.com/adipurnama/go-toolkit.git
Documentation: pkg.go.dev

# Packages

Package echoapmkit for echo & APM functionalies.
Package echotestkit provides echo test helpers.

# Functions

BodyDumpHandler logs incoming request & outgoing response body.
NewRuntimeConfig returns *RuntimeConfig based on viper configuration with layout: given config file contents: restapi: port: 8088 request-timeout: 10s healthcheck-path: /health/info info-path: /actuator/info shutdown: wait-duration: 3s timeout-duration: 5s call using `echokit.NewRuntimeConfig(v, "restapi")`.
PrintRoutes prints *echo.Echo routes.
RequestIDLoggerMiddleware - adds request ID for incoming http request.
RunServer run graceful restapi server.
RunServerWithContext run graceful restapi server with existing background context provides default '/actuator/health' as healthcheck endpoint provides '/metrics' as prometheus metrics endpoint.
TimeoutMiddleware sets upstream request context's timeout.
Validate validates request body for incoming echo.Context request returns web.HTTPError contains field errors (if any).
ValidatorTranslatorMiddleware adds request body validator's translator based on 'Accept-Lang' header.
WithRequestIDKey returns an Option which sets `key` as request-ID lookup to use for logging server requests.
WithTraceIDKey returns an Option which sets `key` as trace-ID lookup to use for logging server requests.

# Structs

RuntimeConfig defines echo REST API runtime config with healthcheck.
TimeoutConfig request timeout configuration default value: - timeout: 7 seconds - middleware.DefaultSkipper / apply to all url.

# Type aliases

HealthCheckFunc is healthcheck interface func.
Option sets options for request middleware.