Macaron: a high productive and modular web framework in Go
go-macaron.com
go-macaron.com
No.
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.
keeping it all type safe ( not having the user cast interface{} to struct everywhere) and performant would be a challenge.
anyway, it should make for a good exercise i'm sure.
as for the definition of Object-Relationnal-Mapper the idea is to completely abstract the fact that you're storing your object graph ( or struct graph in the case of go) in a relationnal database. To do so, the developper provides meta data , like an xml file or annotation, to describe the mapping. This is a pretty hard problem.
If you know ahead of time what your types are, then you can do everything in code gen easily.
The tough bit is query optimization.
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.
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!
So you definitely could implement an ORM in go without code generation - it's almost certainly been done.
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.
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.
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
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.
[1] http://d31f1lobboyy59.cloudfront.net/wp-content/uploads/2014...