
Macaron: a high productive and modular web framework in Go - type0
https://go-macaron.com/
======
virmundi
I quickly looked this over. Does Golang have some hidden ORM like feature that
makes complex persistence easy? I spent the last three months working on a
storage mechanism that controls all of CRUD at the document level across what
is essentially Google Groups (each op is allowed to multiple groups). This is
where web work is complex.

~~~
bsaul
Came here to say the same thing. Go won't enter "crud webapp" market until
they have a better story on relational db interactions. I'm afraid this is way
beyond the current possibilities of the language as it offer barely any meta-
programming technics, on purpose.

~~~
kaio
Did you had a look at sqlx? [1] Granted, it won't generate the queries for you
- but parsing into structs works 95% of time without additional mapping for
me. Coming from other languages I also found the amount of necessary typing a
bit disturbing first. But then you can actually read code instead of orm
framework documentation, issue trackers and workarounds.

[1] [http://jmoiron.github.io/sqlx/](http://jmoiron.github.io/sqlx/)

~~~
bsaul
sqlx didn't work in my case last time i tried (don't remember why exactly),
but it's still far from any standard like sqlalchemy (python), hibernate
(java) , active records (ruby),entity framework (.net), doctrine (php) or
bookshelf (js).

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.

~~~
weberc2
We use SQLalchemy at work and I would rather write queries by hand. A lot of
that is because the documentation is a huge pain, but also because the object
composition isn't intuitive. I've built a profile query builder in Go and it
was pretty straight forward; I'm confident I could build an ORM in a couple of
weeks.

~~~
bsaul
sqlalchemy ( which i used and liked a lot) has multiple layers. query builder
is the bottom one, but the most "challenging" one for go is probably the orm
with things lazy loading and its parametrization ( such as eager loading of
relationships).

keeping it all type safe ( not having the user cast interface{} to struct
everywhere) and performant would be a challenge.

~~~
weberc2
I'm not sure exactly what you mean about parameterization, but I suspect in
general my notion of what an ORM is differs from yours (in particular, I don't
assume lazy loading). Maybe what I'm thinking isn't appropriately called "ORM"
(maybe "type relational mapping" is more appropriate?). At any rate, I don't
think type safety should be a challenge (somehow a mapping must be generated
for each type, just like SQLAlchemy--in Go this can be either explicit or
inferred once via reflection or code generation) and I don't think performance
would be more a challenge in Go than any other language (the trick to ORM
performance is in building efficient SQL queries, not in reflection or type
asserts).

~~~
bsaul
compile-time code generation can only get you so far, unless you're ready to
generate every single kind of query beforehand ( which grows exponentially
with the number of -to-many relationship). You'll have to rely on
introspection but i suspect things won't go smoothly.

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.

~~~
weberc2
It's not too difficult. Where I work, we're building a BI tool that maps
domain concepts ("objects") to fields in relational databases (we're using
Python and building out SQLAlchemy queries, but we're not doing anything that
wouldn't easily translate into Go). The domain concepts are analogous to
structs in Go or simple classes in Python. You only need to get the mapping
data once (in our case, the user configures these mappings in the UI and then
we load them at runtime, but these could come from anywhere) and from then on
there is no magic.

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.

------
0xCMP
Developed by a very smart, nice guy who used this to make Gogs among other
things. I've been using Gogs for almost 2.5 years now and I've had zero
downtime or issues. It's reliability and efficiently is one of the reasons I
began very strongly learning and using Golang more.

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.

------
simplehuman
Macaron is awesome. It's used in Gogs and Gitea

~~~
mon22
Grafana uses it as well last I checked

------
cgdub
Does this have hot reloading?

~~~
mb22
Just use Gin:
[https://github.com/codegangsta/gin](https://github.com/codegangsta/gin)

------
whoiskevin
Starting to feel like Go is suffering from a glut of web frameworks.

~~~
0xCMP
This framework has been around forever and not really. Most people use the
standard library unless they need better routing than the standard library
provides.

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

~~~
whoiskevin
Well I wasn't commenting on age of particular projects. I had not heard of
Beego so now I still feel there is a bit of over growth. Leads to confusion
over what to use when you do want better routing which I think is pretty much
every project. Perhaps routing will continue to improve in the standard
library such that it does not feel like I need to pick a package or roll my
own.

------
jrs95
I read this as Macron at first lol

~~~
amelius
And I expected their project logo to be more akin to e.g. [1].

[1] [http://d31f1lobboyy59.cloudfront.net/wp-
content/uploads/2014...](http://d31f1lobboyy59.cloudfront.net/wp-
content/uploads/2014/12/Macaron-photo-2.jpg)

~~~
weberc2
Same

