Go Gin Binding and Validation Tags for Request Payloads
Gin binds request data into Go structs using struct tags, and validates it with the validator library through the binding tag. Prefer the ShouldBind family...
Category
Gin binds request data into Go structs using struct tags, and validates it with the validator library through the binding tag. Prefer the ShouldBind family...
Request IDs correlate logs across services without proving caller identity. Start with a clearly defined correctness invariant and workload. Identify the state...
A maintainable Gin API separates transport, business logic, and data access into handlers, services, and repositories, with dependencies pointing inward from...
Go's database/sql package manages a connection pool for you, and its default settings are rarely right for a production API. Set a maximum number of open...
Structured logging middleware for Gin records one machine-readable log line per request, with a request ID that ties together every log message produced while...
Distributed trace context links spans from separate services into one request path. Begin with an invariant that the service must preserve even when users...
Server read, header, write and idle timeouts bound different stages of an HTTP connection. Begin with an invariant that the service must preserve even when...
Centralized error handling in Gin means handlers record errors with c.Error and a middleware converts them into consistent HTTP responses. Per handler...
In a Gin handler, pass c.Request.Context() to every database and outbound call, and wrap it with context.WithTimeout to enforce a deadline. When the client...