goadesign / gorma

Storage generation plugin for Goa
http://goa.design
MIT License
140 stars 35 forks source link

boolean types not updated to false #133

Closed jsimonetti closed 8 years ago

jsimonetti commented 8 years ago

When a boolean type needs to be updated to false, this is not done by gorma. This is due to a problem in gorm. See https://github.com/jinzhu/gorm/issues/217#issuecomment-54419404 for a description of the problem and 3 possible solutions.

A solution to this inside gorma would be greatly appreciated.

jsimonetti commented 8 years ago

This appears to be the case with all fields that need to be updated to default Go values

( update integer to 0, update string to "", etc)

moorereason commented 8 years ago

Try using pointers in your Go structs. Then gorm can tell if it's nil or a zero-value.

jsimonetti commented 8 years ago

I have actually seen that using the BuildsFrom DSL in your design, a new UpdateFromXPayload function is created. This function updates the database in a correct way. So this issues is resolved/non-existent for me. Just wanted to comment for future reading.