package utils import "github.com/gin-gonic/gin" type RespStatus struct { Code int `json:"code"` ErrorId string `json:"error_id"` Status string `json:"status"` Data any `json:"data"` } func HttpResponse(c *gin.Context, code int, errorId string, status string, data ...any) { var resp = RespStatus{ Code: code, ErrorId: errorId, Status: status, Data: data, } c.JSON(code, resp) } func HttpAbort(c *gin.Context, code int, errorId string, status string, data ...any) { var resp = RespStatus{ Code: code, ErrorId: errorId, Status: status, Data: data, } c.AbortWithStatusJSON(code, resp) }