Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServiceContextMiddleware ¶
func ServiceContextMiddleware[T any](logger *zap.Logger, tracer *trace.Tracer, props T) echo.MiddlewareFunc
ServiceContextMiddleware injects objects to echo.Context.
Types ¶
type ServiceContext ¶
type ServiceContext[T any] struct { echo.Context ZapLogger *zap.Logger Tracer *trace.Tracer // Props would be shared across all requests in the service Props T // RequestProps values are unique to each requests RequestProps map[string]interface{} }
ServiceContext contains the echo.Context and custom properties vital for a microservice.
func GetServiceContext ¶
func GetServiceContext[T any](ctx echo.Context) *ServiceContext[T]
GetServiceContext returns the ServiceContext from echo.Context.
func (*ServiceContext[T]) BindValidate ¶
func (c *ServiceContext[T]) BindValidate(i interface{}) error
BindValidate binds the data to the given interface and validates the input given using validator/10.
Click to show internal directories.
Click to hide internal directories.