go_echo_wol/res/res.go

24 lines
401 B
Go

package res
import "encoding/json"
type response struct {
Code int
Message string
Error string
Data string
}
func Get_res_string(Code int, Message string, Error string, Data string) string {
var res = new(response)
res.Code = Code
res.Message = Message
res.Error = Error
res.Data = Data
res_str, err := json.Marshal(res)
if err != nil {
panic(err)
}
return string(res_str)
}