Crystal ORMs

#1

I am looking for an ORM to use for an app and keep going back and forth between Clear and Granite. It seems like Granite generates faster queries and Clear has more DB features exposed with great APIs. I was wondering if anyone had any more thoughts on these ORMs. I am having trouble picking them between projects. I want to use things like jsonb and enums so I keep falling back to clear. But, I am not sure if it is worth the effort to try and get them into granite.

#2

Granite also has nice support for serializing your models, as the serialization is built on the serializable modules, i.e. you can do from_json/yaml to create your models, which is quite handy when working with APIs. Another benefit of Granite is that it supports third party annotations, if you will be using any shards that use them.

Clear was nice when I used it, although I don’t remember the specifics. Granite doesn’t really support custom DB types atm, I’m not too familiar with PG enums so I can’t really give an estimate of the effort required to add them.

1 Like
#3

Do you have a link to Granite’s support third party annotations?

Clear says it is an ORM that only plans on supporting postgres and that means they can dive more into those features and after using it a little that seems right.

#4

Yea for sure, if you’re going to be using PG then it would make more sense, probably wouldn’t be hard to install both and play with each and see which you like better.

Syntax isn’t the best but is required due to how Granite adds the properties. Is better than nothing tho.

#5

I have small projects with both. I was just seeing if people had some more insights.