Documentation
¶
Index ¶
- func DecodeJSON(c *gin.Context, value any) error
- func DecodeQuery(c *gin.Context, value any) error
- func DecodeURI(c *gin.Context, value any) error
- func Error(ctx *gin.Context, err error)
- func Handle[T any](handler func(*gin.Context) (T, error), opts ...ResponseOption) gin.HandlerFunc
- func NoContent(handler func(*gin.Context) error) gin.HandlerFunc
- func ParseRequest(ctx *gin.Context, req interface{}) error
- type APIAuth
- type JWTValidator
- type ResponseOption
- type Server
- type ServerDI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶
DecodeJSON matches field names case-insensitively and rejects duplicate fields and malformed UTF-8 through Go JSON v2. Decoding failures are BadRequest (400); DTO binding-tag violations are NotValid (422). Oversized bodies are rejected with 413 by the HTTP adapters. Errors retain their causes and are returned without writing a response.
func DecodeQuery ¶
DecodeQuery separates representation errors (400) from constraints (422), without allowing Gin's binding helpers to write a response prematurely.
func Handle ¶
func Handle[T any](handler func(*gin.Context) (T, error), opts ...ResponseOption) gin.HandlerFunc
Handle owns response encoding and error mapping; handlers return typed values.
func ParseRequest ¶
Types ¶
type APIAuth ¶
type APIAuth struct {
Token string
}
APIAuth explicitly enables token authentication, even when Token is empty.
type JWTValidator ¶
func NewAuth0JWTValidator ¶
func NewAuth0JWTValidator(issuerURL, audience string) (JWTValidator, error)
type ResponseOption ¶
type ResponseOption func(*responseOptions)
func WithStatus ¶
func WithStatus(status int) ResponseOption
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ServiceName ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.