6 ms·
How good are the ORMs options in Go? One of the reasons Rails is my go-to for web development is how easy Active Record it makes configuration and changing data
by meow_mix 10y ago
How good are the ORMs options in Go? One of the reasons Rails is my go-to for web development is how easy Active Record it makes configuration and changing databases.
- kevinburke 10y agoI'm not a big fan of Active Record (https://kev.inburke.com/kevin/faster-correct-database-queries/ https://kev.inburke.com/kevin/faster-correct-database-querie...) and tend to just write queries by hand. The benefit of this is you can Prepare them, which alerts you to syntax errors earlier and means the database doesn't have to parse the query each time you execute it. You also don't need to return every column if you know you only need an email address. I know people that have had success with gorm or sqlx.
- segmondy 10y agoHow many times have you changed databases in your production apps or are you building and selling software and wanting users to be able to pick their own database?
- ksubedi 10y agoI don't think that is the only reason to use ORM's. They definitely help me be more productive while building apps where super-high performance is not an issue.
- deckiedan 10y agoI really like the flexibility of being able to swap around dbs during initial development. At some point along the way once almost the whole major systems are working, I'll need to decide if I need FTS, sharding, to work on a shared host that already has MySQL / interact with a wordpress site, etc.
- nzoschke 10y agoThis weekend I played with the Buffalo framework [1] which includes "pop" [2] which an ORM of sorts. I really enjoyed working with both. It's nowhere near as magical as Rails, but it totally reduced the amount of code/boilerplate I needed to set up databases, migrations and to get Go "model" structs to and from the database. [1] http://gobuffalo.io/docs/getting-started http://gobuffalo.io/docs/getting-started [2] https://github.com/markbates/pop https://github.com/markbates/pop
- znq 10y agoWe've started building Bugfender using GORM and it was good for the initial job, but we now decided to remove it completely and continue on a lower level. We've summarized our whole experience with Go here: https://bugfender.com/one-year-using-go https://bugfender.com/one-year-using-go and we're just wrapping up another blog post with the Go pros and cons (from our point of view), which should be out soon as well. The biggest problem with go is, that it is still a very fast and changing ecosystem. Which is great for a new language, but didn't serve us too well for building something stable.
- sagichmal 10y agoIn which universe is Go a part of a fast-changing ecosystem? It certainly isn't this one! The Go language abides a strict compatibility guarantee. Libraries, perhaps due to the poor dependency management situation, tend more than other language ecosystems to avoid breaking changes, or at least hide them behind different import paths. Go has arguably the least dynamic, most boring ecosystem among popular languages today!
- inimino 10y agoCompared to Java or PHP? Or did you mean "trendy" rather than popular?
- sagichmal 10y agoYes, controlled for age, I think Go is even more static and boring than Java or PHP.
- inimino 10y agoI don't know much about the Go ecosystem but this makes me want to try it. You can't really control for age though... how does it compare to Rust in terms of stability (a language of similar age and scope)?
- 10y ago
- bsaul 10y agoImho, not good. They feel like a hack. It's the main reason i wouldn't use go for building a webapp that needs to discuss with a moderately large sql backend.
- frik 10y agoYou are coming from the opposite side. Go is leaner, like Nodejs and PHP can be used without any frameworks as batteries are included. Asking for ORM means you are comfortable in your framework world. You will have to adopt, if you want to go a leaner way, with direct SQL or NoSQL API. Or find an ORM library (but learn about pro/cons).