Documentation ¶
Index ¶
- func AccessLog(l AccessLogger) func(next http.Handler) http.Handler
- func IsBadRequest(err error) bool
- func IsConflict(err error) bool
- func IsNotFound(err error) bool
- func IsServerError(err error) bool
- func IsUnknown(err error) bool
- func NewBadRequest(format string, v ...interface{}) error
- func NewConflict(format string, v ...interface{}) error
- func NewNotFound(format string, v ...interface{}) error
- func NewServerError(code int, format string, v ...interface{}) error
- func NewUnknown(format string, v ...interface{}) error
- func WriteIntenalServerErrorResponse(logger *zap.Logger, w http.ResponseWriter, err error)
- func WriteNoContentResponse(logger *zap.Logger, w http.ResponseWriter)
- func WriteOkResponse(logger *zap.Logger, w http.ResponseWriter, body []byte)
- func WriteResponse(logger *zap.Logger, w http.ResponseWriter, responseCode int, body []byte)
- type AccessLogger
- type AccessRequest
- type AccessResponse
- type ClientError
- type ZapAccessLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBadRequest ¶
func IsConflict ¶
func IsNotFound ¶
func IsServerError ¶
func NewBadRequest ¶
func NewConflict ¶
func NewNotFound ¶
func NewServerError ¶
func NewUnknown ¶
func WriteIntenalServerErrorResponse ¶
func WriteIntenalServerErrorResponse(logger *zap.Logger, w http.ResponseWriter, err error)
func WriteNoContentResponse ¶
func WriteNoContentResponse(logger *zap.Logger, w http.ResponseWriter)
func WriteOkResponse ¶
func WriteOkResponse(logger *zap.Logger, w http.ResponseWriter, body []byte)
func WriteResponse ¶
Types ¶
type AccessLogger ¶
type AccessLogger interface {
AccessLog(ctx context.Context, req AccessRequest, res AccessResponse, dur time.Duration)
}
type AccessRequest ¶
type AccessResponse ¶
type ClientError ¶
type ClientError struct {
// contains filtered or unexported fields
}
func (*ClientError) Error ¶
func (c *ClientError) Error() string
type ZapAccessLogger ¶
type ZapAccessLogger struct {
LogContextKey interface{}
}
func (*ZapAccessLogger) AccessLog ¶
func (l *ZapAccessLogger) AccessLog(ctx context.Context, req AccessRequest, res AccessResponse, dur time.Duration)
Click to show internal directories.
Click to hide internal directories.