Closed linxiang4200 closed 6 days ago
Hi, this is the solution
type Person struct { Name string }
var p Person // this will NOT return an error, even though place columns have no destination udb := db.Unsafe() err = udb.Get(&p, "SELECT * FROM person, place LIMIT 1;")
I have a table named resource and have defined a struct for it. However, I now need to add a new field to the table, but when this field is not yet added to the struct definition in the code, running the code results in an error: "missing destination name scene_type in []model.Resource." ,even though I didn't use this field . How can I avoid this error? Since database changes and code changes are not deployed simultaneously, this could cause issues when the service goes live.
Thanks!
Issue description
I have a table named resource and have defined a struct for it. However, I now need to add a new field to the table, but when this field is not yet added to the struct definition in the code, running the code results in an error: "missing destination name scene_type in []model.Resource." ,even though I didn't use this field . How can I avoid this error? Since database changes and code changes are not deployed simultaneously, this could cause issues when the service goes live.
Example code
Error log