Can I pass a generic struct or interface into a function, and then return it? I've tried using pointers in the example below, and I've also tried using struct as a return type but I can't seem to do it.
If I use interface{} instead, I seem to be able to pass postData in but getting it back seems to be impossible by returning or updating a pointer. Can anyone tell me where I'm going wrong?
func EmailHandler(writer http.ResponseWriter, request *http.Request) {
var postData = EmailPostData{}
ConvertRequestJsonToJson(request, &postData)
}
func ConvertRequestJsonToJson(request *http.Request, model *struct{}) {
postContent, _ := ioutil.ReadAll(request.Body)
json.Unmarshal([]byte(postContent), &model)
}