go_echo_wol/res/res.go

24 lines
401 B
Go
Raw Normal View History

2023-09-02 11:47:53 +08:00
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)
}