handler

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderRequestID = "X-Request-Id"
View Source
const Prefix = "/api/v1"

Variables

This section is empty.

Functions

func LoggerMiddleware

func LoggerMiddleware(logger logrus.FieldLogger, now func() time.Time, timeFormat string, utc bool) gin.HandlerFunc

LoggerMiddleware returns a gin.HandlerFunc (middleware) that logs requests using logrus.

Requests with errors are logged using logrus.Error(). Requests without errors are logged using logrus.Info().

It receives:

  1. A time package format string (e.g. time.RFC3339).
  2. A boolean stating whether to use UTC time zone or local.

func New

func New(correios correios.Correios, storage storage.Storage, health gosundheit.Health, release bool, now func() time.Time) http.Handler

Types

type HTTPErrorResponse

type HTTPErrorResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Details interface{} `json:"details,omitempty"`
}

func (*HTTPErrorResponse) Error

func (er *HTTPErrorResponse) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL