package dto type JSendResponse struct { Status string `json:"status"` Data interface{} `json:"data,omitempty"` Message string `json:"message,omitempty"` Code int `json:"code,omitempty"` } func JSendSuccess(data interface{}) JSendResponse { return JSendResponse{ Status: "success", Data: data, } } func JSendError(message string, code int) JSendResponse { return JSendResponse{ Status: "error", Message: message, Code: code, } } func JSendFail(message string, code int) JSendResponse { return JSendResponse{ Status: "fail", Message: message, Code: code, } }