-
Notifications
You must be signed in to change notification settings - Fork 376
Open
Labels
Milestone
Description
One thing that seems like it could become problematic is:
http://godoc.org/github.com/coopernurse/gorp#DbMap.Select
"Returns an error if one or more columns in the result do not match"
I think the common case will be someone writing
type Model struct {
// many fields
}
dbm.Select(&models, "SELECT * FROM models WHERE ...")Presently, as soon as a field is added to the table, the Select will start returning errors. This requires the developer to type out the entire field list for every select to be correct, otherwise there is no way to alter the table without trouble.
Two solutions could be:
- Don't return an error if you don't have a place for a returned column (bad, but easy)
- Provide a syntax for inserting the list of fields that you expect (better)
The latter could work like this:
dbm.Select(&models, "SELECT ... FROM models")or
dbm.Select(&models, "SELECT {} FROM models")and that could be replaced by the list of fields expected in type Model.