Live data from Hacker News

Macaron: a high productive and modular web framework in Go

go-macaron.com

31–40 of 52 posts

Re: Macaron: a high productive and modular web framework in Go

#31
post #5
post #2

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.

> Does Golang have some hidden ... feature No.

haha

Re: Macaron: a high productive and modular web framework in Go

#32
post #2

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.

I'm no expert, but I think for ORM like you're referring to, the language would need features like generics, which Go doesn't have and may never have. At best there would be a code generator which would allow you to write your stuff in a higher-level language which would generate compilable and efficient Go code in turn.

Code generation is one way to get around generics. Go also stores all the type data at runtime so you can inspect the arguments passed to any function, which gives the same kind of generic behavior in any dynamically typed language.

So you definitely could implement an ORM in go without code generation - it's almost certainly been done.

Re: Macaron: a high productive and modular web framework in Go

#33
post #8
post #2

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.

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.

check out https://github.com/upper/db as well while you evaluate the various projects

Re: Macaron: a high productive and modular web framework in Go

#35

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

It happens anytime a language has the web tooling built in so a framework largely becomes arranging parts to your preference and naming it.

See PHP and JavaScript.

The languages that don't have all the web stuff built in tend to have a single dominant framework.

Re: Macaron: a high productive and modular web framework in Go

#36
post #2

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.

I've been experimenting with a library called `refmt` which does the Object Mapping part, but explicitly not the Relational part. It's still experimental, but you might like it, and test coverage is shaping up nicely.

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.

https://github.com/polydawn/refmt

Re: Macaron: a high productive and modular web framework in Go

#38
post #27
post #13

Earlier quoted context omitted.

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…

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.

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.

Re: Macaron: a high productive and modular web framework in Go

#39

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

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

Re: Macaron: a high productive and modular web framework in Go

#40
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.

Post reply on HN