Documentation ¶
Index ¶
- func EchoErrorResponse(c echo.Context, statusCode int, message, errorDetail string) error
- func EchoSuccessResponse(c echo.Context, message string, data interface{}) error
- func FiberErrorResponse(c *fiber.Ctx, statusCode int, message, errorDetail string) error
- func FiberSuccessResponse(c *fiber.Ctx, message string, data interface{}) error
- func GenerateErrorResponse(traceID, message, errorDetail string) core.StandardResponse
- func GenerateSuccessResponse(traceID, message string, data interface{}) core.StandardResponse
- func GenerateValidationErrorResponse(traceID, message string, fieldErrors map[string]interface{}) core.StandardResponse
- func GetOrGenerateTraceID(headers http.Header) string
- func GinErrorResponse(c *gin.Context, statusCode int, message, errorDetail string)
- func GinSuccessResponse(c *gin.Context, message string, data interface{})
- func HTTPErrorResponse(w http.ResponseWriter, r *http.Request, statusCode int, ...)
- func HTTPSuccessResponse(w http.ResponseWriter, r *http.Request, message string, data interface{})
- func LogRequest(method, path, traceID string, headers http.Header)
- func LogResponse(method, path, traceID string, statusCode int, duration time.Duration)
- func WriteJSONResponse(w http.ResponseWriter, statusCode int, response core.StandardResponse)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EchoErrorResponse ¶
EchoErrorResponse sends an error response in Echo with logging.
func EchoSuccessResponse ¶
EchoSuccessResponse sends a success response in Echo with logging.
func FiberErrorResponse ¶
FiberErrorResponse sends an error response in Fiber with logging.
func FiberSuccessResponse ¶
FiberSuccessResponse sends a success response in Fiber with logging.
func GenerateErrorResponse ¶
func GenerateErrorResponse(traceID, message, errorDetail string) core.StandardResponse
GenerateErrorResponse creates a standardized error response.
func GenerateSuccessResponse ¶
func GenerateSuccessResponse(traceID, message string, data interface{}) core.StandardResponse
GenerateSuccessResponse creates a standardized success response.
func GenerateValidationErrorResponse ¶
func GenerateValidationErrorResponse(traceID, message string, fieldErrors map[string]interface{}) core.StandardResponse
GenerateValidationErrorResponse creates a validation error response.
func GetOrGenerateTraceID ¶
GetOrGenerateTraceID retrieves a trace ID from headers or generates a new one.
func GinErrorResponse ¶
GinErrorResponse sends an error response in Gin with logging.
func GinSuccessResponse ¶
GinSuccessResponse sends a success response in Gin with logging.
func HTTPErrorResponse ¶
func HTTPErrorResponse(w http.ResponseWriter, r *http.Request, statusCode int, message, errorDetail string)
HTTPErrorResponse sends an error response for net/http with logging.
func HTTPSuccessResponse ¶
func HTTPSuccessResponse(w http.ResponseWriter, r *http.Request, message string, data interface{})
HTTPSuccessResponse sends a success response for net/http with logging.
func LogRequest ¶
LogRequest logs incoming request details.
func LogResponse ¶
LogResponse logs outgoing response details.
func WriteJSONResponse ¶
func WriteJSONResponse(w http.ResponseWriter, statusCode int, response core.StandardResponse)
WriteJSONResponse writes the response to the client.
Types ¶
This section is empty.