Closed Raul-diffindo closed 9 years ago
I have the following route:
m.Post("/users", binding.Bind(models.User{}), func(user models.User, r render.Render)
And I receive the following error message when I try to do a Post request:
"PANIC: reflect.Value.Interface: cannot return value obtained from unexported field or method"
My model is:
type User struct { id int UUID string `json:"uuid"` Username string `json:"userName" form:"userName" binding:"required"` Firstname string `json:"firstName" form:"Firstname" binding:"required` Lastname string `json:"lastName" form:"Lastname" binding:"required` Email string `json:"email" form:"Email" binding:"required` IsActive bool `json:"isActive"` DateJoined time.Time `json:"dateJoined"` }
Sorry. The problem was the attribute "id". If I set this as "Id" works perfectly or if I set the tag form:"-" too.
form:"-"
Thank you and sorry for the question. You can delete it.
Ah, no problem. Forgetting to export fields used by other packages is easy to do.
I have the following route:
And I receive the following error message when I try to do a Post request:
My model is:
Sorry. The problem was the attribute "id". If I set this as "Id" works perfectly or if I set the tag
form:"-"
too.Thank you and sorry for the question. You can delete it.