Documentation ¶
Index ¶
- func CheckRequestHandler[request any, response any](checkFunc func(request) (bool, string)) func(ctx *Context[request, response])
- func CheckResponseHandler[request any, response any](checkFunc func(response) (bool, string)) func(ctx *Context[request, response])
- func ExecuteChain[request any, response any](handlers Chain[request, response], ctx context.Context, req request, ...) (result response, err error)
- func LogInputAndOutputHandler[request any, response any](log logger.Logger, service string, handler string) func(ctx *Context[request, response])
- func RecoveryHandler[request any, response any](log logger.Logger, service string, handler string) func(ctx *Context[request, response])
- func RequestLimiterHandler[request any, response any](rpd, rpm, rps int) func(ctx *Context[request, response])
- func RequestLimiterHandlerWithFn[request any, response any](rpd, rpm, rps int, _ func(request) (response, error)) func(ctx *Context[request, response])
- type Chain
- type CheckRequestFailedError
- type CheckResponseFailedError
- type Context
- func (c *Context[request, response]) Abort()
- func (c *Context[request, response]) Deadline() (deadline time.Time, ok bool)
- func (c *Context[request, response]) Done() <-chan struct{}
- func (c *Context[request, response]) Err() error
- func (c *Context[request, response]) Error() error
- func (c *Context[request, response]) GetContext() context.Context
- func (c *Context[request, response]) GetContextClientIP() (ip string, err error)
- func (c *Context[request, response]) GetRequest() request
- func (c *Context[request, response]) GetResponse() response
- func (c *Context[request, response]) IsAborted() bool
- func (c *Context[request, response]) Next()
- func (c *Context[request, response]) SetContext(ctx context.Context)
- func (c *Context[request, response]) SetError(err error)
- func (c *Context[request, response]) SetRequest(req request)
- func (c *Context[request, response]) SetResponse(resp response)
- func (c *Context[request, response]) SetResult(resp response, err error)
- func (c *Context[request, response]) TraceID() string
- func (c *Context[request, response]) Value(key any) any
- type Engine
- type GetRPCClientIPFailedError
- type Handler
- type InvalidIPAddressError
- type Marshaller
- type RequestLimiterError
- type ServerAlreadyServingError
- type Service
- type UnsupportedNetworkError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRequestHandler ¶
func CheckResponseHandler ¶
func ExecuteChain ¶
func RecoveryHandler ¶
func RequestLimiterHandler ¶
Types ¶
type Chain ¶
func (Chain[request, response]) AddHandlerBack ¶ added in v1.2.9
func (Chain[request, response]) AddHandlerFront ¶ added in v1.2.9
type CheckRequestFailedError ¶
type CheckRequestFailedError struct {
Reason string
}
func NewCheckRequestFailedError ¶
func NewCheckRequestFailedError(reason string) CheckRequestFailedError
func (CheckRequestFailedError) Error ¶
func (e CheckRequestFailedError) Error() string
type CheckResponseFailedError ¶
type CheckResponseFailedError struct {
Reason string
}
func NewCheckResponseFailedError ¶
func NewCheckResponseFailedError(reason string) CheckResponseFailedError
func (CheckResponseFailedError) Error ¶
func (e CheckResponseFailedError) Error() string
type Context ¶
func NewContext ¶
func (*Context[request, response]) Done ¶
func (c *Context[request, response]) Done() <-chan struct{}
func (*Context[request, response]) GetContext ¶
func (*Context[request, response]) GetContextClientIP ¶
func (*Context[request, response]) GetRequest ¶
func (c *Context[request, response]) GetRequest() request
func (*Context[request, response]) GetResponse ¶
func (c *Context[request, response]) GetResponse() response
func (*Context[request, response]) SetContext ¶
func (*Context[request, response]) SetRequest ¶
func (c *Context[request, response]) SetRequest(req request)
func (*Context[request, response]) SetResponse ¶
func (c *Context[request, response]) SetResponse(resp response)
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) AddService ¶
func (*Engine) ServeAsync ¶
type GetRPCClientIPFailedError ¶
type GetRPCClientIPFailedError struct{}
func NewGetRPCClientIPFailedError ¶
func NewGetRPCClientIPFailedError() GetRPCClientIPFailedError
func (GetRPCClientIPFailedError) Error ¶
func (e GetRPCClientIPFailedError) Error() string
type InvalidIPAddressError ¶
type InvalidIPAddressError struct {
IPAddress string
}
func NewInvalidIPAddressError ¶
func NewInvalidIPAddressError(ipAddress string) InvalidIPAddressError
func (InvalidIPAddressError) Error ¶
func (e InvalidIPAddressError) Error() string
type Marshaller ¶
type Marshaller interface { Marshal(request any) ([]byte, error) Unmarshal(data []byte, response any) error }
func NewJsonMarshaller ¶
func NewJsonMarshaller() Marshaller
func NewYamlMarshaller ¶
func NewYamlMarshaller() Marshaller
type RequestLimiterError ¶
type RequestLimiterError struct {
Reason string
}
func NewRequestLimiterError ¶
func NewRequestLimiterError(reason string) RequestLimiterError
func (RequestLimiterError) Error ¶
func (e RequestLimiterError) Error() string
type ServerAlreadyServingError ¶
type ServerAlreadyServingError struct {
Address string
}
func NewServerAlreadyServingError ¶
func NewServerAlreadyServingError(address string) ServerAlreadyServingError
func (ServerAlreadyServingError) Error ¶
func (e ServerAlreadyServingError) Error() string
type UnsupportedNetworkError ¶
type UnsupportedNetworkError struct {
Network string
}
func NewUnsupportedNetworkError ¶
func NewUnsupportedNetworkError(network string) UnsupportedNetworkError
func (UnsupportedNetworkError) Error ¶
func (e UnsupportedNetworkError) Error() string
Click to show internal directories.
Click to hide internal directories.