112 points · by type0 · 9y ago · 48 comments
Writing every select for every entity, with all the variations depending on whether you want to inner join with 1-n relationships (and which ones) is really tedious when you've got 30 entities in your model.
It could make sense in some context, and i'm pretty sure that any sufficiently advanced service has so many custom and optimized queries that an ORM doesn't make a difference.
however IMHO, ORMs do play a very important role in the beginning of the project when prototyping screens and apis, and when rapid iteration is important. It isn't a coincidence that RoR advertized active record as much, that symfony use doctrine in all tutorials, and that java , .net and node.js frameworks all include an ORM component.
So you definitely could implement an ORM in go without code generation - it's almost certainly been done.
No.
The idea is by focusing completely on making Object Mapping consistent and powerfully customizable, and then composing that with either serialization formats or relational storage, we'll get good things. Right now we seem to be at and awkward hump of complexity where every new DB binding ends up implementing their own object mapping, increasing everyone's complexity, overhead, and decreasing reusability of code; refmt will hopefully represent a break from that.
In the past I've had great success with XO, which will generate Go code from an existing DB Schema:
It's really very good!
A Django project can't use less than 100mb of memory because of Python. Gogs is a full github clone which uses 5-10mb on average. When you're trying to run something self-hosted it's super valuable that you don't need a huge server(i.e. $$$) just to make it responsive which helps make self-hosting make sense economically.
It shouldn't be supported at the router/framework level. Use an external app to monitor changes in a directory and reload the web app.
People are going to write code for multiple reason. You can't complain about people writing opensource code, you're not forced to use it.
See PHP and JavaScript.
The languages that don't have all the web stuff built in tend to have a single dominant framework.
There are actually very few web frameworks that provide much other than a router in Go. Most of the frameworks are actually just packages that can be used for all sorts of things. e.g. Beego by astaxie
[1] http://d31f1lobboyy59.cloudfront.net/wp-content/uploads/2014...