package message import ( "github.com/gin-gonic/gin" ) type Response struct { Status int Message gin.H Error []string } 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, gin.H{"errors": response.Error}) } }