package model import "net/http" type Response struct { Code int `json:"code"` Data interface{} `json:"data,omitempty"` Message string `json:"message,omitempty"` } func OK(data interface{}) Response { return Response{Code: http.StatusOK, Data: data} } func Created(data interface{}) Response { return Response{Code: http.StatusCreated, Data: data} } func NoContent() Response { return Response{Code: http.StatusNoContent} } func BadRequest(msg string) Response { return Response{Code: http.StatusBadRequest, Message: msg} } func Unauthorized(msg string) Response { return Response{Code: http.StatusUnauthorized, Message: msg} } func Forbidden(msg string) Response { return Response{Code: http.StatusForbidden, Message: msg} } func NotFound(msg string) Response { return Response{Code: http.StatusNotFound, Message: msg} } func InternalError(msg string) Response { return Response{Code: http.StatusInternalServerError, Message: msg} }