Which ORM is best for Golang

Hello Everyone here. I am learning Golang from last month and I want to know more about it so posting in the forum. So tell me, which ORM framework is the best for Go that supports features like hibernate in java ?

Hibernate is a complex framework with many features. Which of those do you need?

Actually I found this GORM library for Golang https://github.com/jinzhu/gorm but still I am having issues like in MVC architecture suppose if I’m saving DTO object in DAO layer and returning to Service Layer and again If i want to set some value like userDto.setEmail("kabeer@gmail.com") then it should persist it and save it to DB by internally creating update query like what Hibernate is doing as per my knowledge.

That is not very concrete question and hard to answer. May I point you to this?

1 Like

Since you are new to Go, I would suggest that you first become familiar with using database/sql with a driver of your choice. Here are some resources to help:

After you get familiarity with working with databases in Go, you might want to check out a 3rd party package like sqlx that can help with writing database code.

As you have discovered there’s also gorm but if you are expecting features that are on par with Hibernate you might be disappointed.

There’s also SQL Boiler which uses code generation to generate an “ORM” tailored to your database schema.

4 Likes

Hey thanks for this one.I’ve started to do work on it.

After one year working with some GORM libraries I use only sqlx now. And if it is possible I avoid SQL database and use BoltDB with Storm.

2 Likes

Hello Mr. Rio_M, Thanks for the reply. But can you tell which issues you found in http://jinzhu.me/gorm/ GORM and also what another features like Hibernate in java it is not supporting.

Any suggestion regarding best ORM for Golang like Hibernate for Java. Also any Golang ORM having features like Hibernate. Awaiting for the reply.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.