3 ms·
I agree SQL is not hard, but getting the data into objects is definitely repetitive work. ORMs are a double-edged sword where people who don't know SQL write b
by dasil003 10y ago
I agree SQL is not hard, but getting the data into objects is definitely repetitive work. ORMs are a double-edged sword where people who don't know SQL write bad ORM code because they can, but a good ORM gives various ORM level that allow one to do the right thing and still save a lot of repetitive boilerplate.
If you avoid an ORM, the typical medium sized CRUD app usually ends up with some poorly conceived bespoke abstractions that would be better used by some flavor of ORM. I'm with you that ORMs make it way too easy for junior devs to blow their leg off, but I still think they provide some very solid abstractions when used correctly.
- ansible 10y agoIf you are doing plain SQL in your golang app, I highly encourage you to check out sqlx: https://github.com/jmoiron/sqlx https://github.com/jmoiron/sqlx It has features like directly unpacking the results of a query into a structure. Very handy.