I made a comment about this on an HN thread about ORMs in Go.

> Personally I think an active record style ORM for Go like gorm is a poor fit for a language that doesn't come across as inherently OOP. Going through some of the documentation for gorm, it seems to rely heavily on method chaining which for Go seems wrong considering how errors are handled in that language. In my opinion, an ORM should be as idiomatic to the language as possible.

> I've used sqlx[1] before, and it feels pretty idiomatic to Go. You tag your structs with their respective database columns, write up a query, and hand it to sqlx to perform the deserialisation of the data. I've also come across squirrel[2] too, though I haven't used it, it does look rather interesting.

> [1] - https://github.com/jmoiron/sqlx

> [2] - https://github.com/masterminds/squirrel

I agree with you when you say that ORMs help with modeling relations. However I think the following the design of ActiveRecord is the wrong approach to take when it comes to ORMs in Go.

Also, regarding database migrations in Go. I made a simple tool for performing database migrations. It allows you to write plain SQL, and have these SQL scripts be performed against the database an logged. Right now it supports SQLite, MySQL, and PostgreSQL, you can find it at https://github.com/andrewpillar/mgrt.

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e2191307-c64f-661e-54a5-d92a19d3390f%40andrewpillar.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to