Hacker News new | ask | show | jobs
by mrweasel 3941 days ago
It might be the problems I solve, or the way I think about them, but I think it's about 50/50 whether the ORM is helpful or in the way. Very often I just want the ORM to go away because I know what I'm doing and the ORM doesn't

I do like sqlx, it seems to hit a balance that works for me. I get to write the SQL and structs come out.

2 comments

sqlx (https://github.com/jmoiron/sqlx) is my go-to as well. mgutz/dat (https://github.com/mgutz/dat) and dbr (https://github.com/gocraft/dbr) are also more ORM-like alternatives if that's what you need—query builders with the option to use raw SQL for more complex queries. I also lean on purse (https://github.com/smotes/purse) for keeping my SQL in separate files, but I'd love to see something like Clojure's yesql.

I think the likelihood of seeing an ActiveRecord-style ORM in Go is slim: ActiveRecord is a core part of Rails and can therefore make a lot of safe assumptions about its environment. Any ORM for Go can't do that to the same extent, and big Rails-style frameworks don't gain much of a following in Go.

I used sqlx for a while and it's definitely an improvement over std sql, but still isn't full orm.