Documentation
¶
Index ¶
- func APIKeyMiddleware() gin.HandlerFunc
- func GetAPIKeyUserID(c *gin.Context) int
- func GetPaginationParams(c *gin.Context) (int, int)
- func GetUserID(c *gin.Context) int
- func RespondWithError(c *gin.Context, statusCode int, message string, err error)
- func RespondWithErrorMessage(c *gin.Context, statusCode int, message string)
- func RespondWithSuccess(c *gin.Context, statusCode int, data interface{})
- type APIKey
- type ErrorResponse
- type SuccessResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIKeyMiddleware ¶
func APIKeyMiddleware() gin.HandlerFunc
APIKeyMiddleware validates API keys for public routes
func GetAPIKeyUserID ¶
GetAPIKeyUserID extracts the API key user ID from the context
func GetPaginationParams ¶
GetPaginationParams extracts and validates pagination parameters
func RespondWithError ¶
RespondWithError sends a standardized error response
func RespondWithErrorMessage ¶
RespondWithErrorMessage is a simplified version of the error response function that only takes a message without an error object
func RespondWithSuccess ¶
RespondWithSuccess sends a standardized success response
Types ¶
type ErrorResponse ¶
ErrorResponse is a standardized error response
type SuccessResponse ¶
type SuccessResponse struct { Success bool `json:"success"` Data interface{} `json:"data,omitempty"` }
SuccessResponse is a standardized success response with data
Click to show internal directories.
Click to hide internal directories.