| Total Lines | 18 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package views |
||
| 2 | |||
| 3 | type HTTPResponseVM struct { |
||
| 4 | Data interface{} `json:"data"` |
||
| 5 | Message string `json:"message"` |
||
| 6 | } |
||
| 7 | |||
| 8 | func NewHTTPResponseVM(message string, data interface{}) HTTPResponseVM { |
||
| 9 | return HTTPResponseVM{ |
||
| 10 | Message: message, |
||
| 11 | Data: data, |
||
| 12 | } |
||
| 13 | } |
||
| 14 | |||
| 15 | func NewHTTPResponseVMFromError(err error) HTTPResponseVM { |
||
| 16 | return HTTPResponseVM{ |
||
| 17 | Message: err.Error(), |
||
| 18 | Data: nil, |
||
| 19 | } |
||
| 21 |