sqlboiler icon indicating copy to clipboard operation
sqlboiler copied to clipboard

Type safe updates

Open rakeshbala opened this issue 5 years ago • 2 comments

Are type-safe updates possible? So far I've seen only an UpdateAll method which takes a map[string] interface{} (as opposed to the type-specific columns in the where clauses).

Apologies if I missed something in the documentation.

rakeshbala avatar May 28 '20 23:05 rakeshbala

I realized that I can do a find and then call Update on the model struct. So that is a workaround. That is still 2 queries I guess and also wouldn't work when I want to update a bunch of rows.

Changing this issue to a feature request to add type-safe columns to UpdateAll call. 🙂

rakeshbala avatar May 28 '20 23:05 rakeshbala

Yep. Currently there's no way to do this. I'm not sure how you would accomplish it either (otherwise we probably would have done it!).

Perhaps you could pass in a single model to the UpdateAll call? And then also a boil.Columns?

aarondl avatar Jun 17 '20 23:06 aarondl