volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.73k stars 544 forks source link

Extension: blacklist for --wipe #342

Closed polderudo closed 6 years ago

polderudo commented 6 years ago

Any chance of adding a blacklist to the --wipe agrument? This would make extending the models very easy, because one can create methods for the models.

aarondl commented 6 years ago

It's been discussed several times in the past. To quote myself:

In the past we've had this discussion and it's ended in a best practice documented in the readme: https://github.com/volatiletech/sqlboiler#extending-generated-models I'd say sticking to these is best. To me there's no downsides to the first model other than maybe a little more verbosity than we'd all like.

One of the biggest reasons for this is largely philosophical; I hold the opinion that hand-written code should never be shoved away inside a directory full of 99% generated code. It's hard to understand where one stops and the other begins. It's especially bad because Go's package model means folder == package. So models.HelpMe <- Is this yours? Or is it sqlboilers? Are you allowed to modify it? All impossible with this approach when reading the code unless you go look at what file the function is in, which seems like a burden put on the reader.

My stance on this hasn't changed since I responded there. Hopefully you find the extending generated models in the readme an acceptable compromise.

polderudo commented 6 years ago

Oh. sorry didn't see that issue. Yes i am ok with the current way of extending it was more of a "idea". Should have read the issues more carefully.

aarondl commented 6 years ago

No problem at all! I'm glad people bring this stuff up. Forces me to re-evaluate my position again and they also come up to speed with the discussion :)