package message import ( "github.com/gin-gonic/gin" ) type Response struct { Status int Message gin.H Error gin.H } func SendResponse(c *gin.Context, response Response) { if len(response.Message) > 0 { c.JSON(response.Status, response.Message) } else if len(response.Error) > 0 { c.JSON(response.Status, response.Error) } }