Which database best choice for rest api in gin framework?

I want to use gin framework for rest or graphql api I don’t know which database best for it? I was using postgresql in elixir for graphql api, it was good fit for Phoenix framework.

AFAIK Gin out of the box uses vanilla SQL but GraphQL is some sort of ORM. If you choose ORM, you may sooner or later hit some limitations you must use vanilla SQL to override. I think any database will work with either. Postgresql is my favorite though.

Can i use postgres db for both graphql and rest in gin?

If you are using Gin, you can communicate direct (using pq driver or similar) or via REST API (can also be built using Go).

Graphql is an API sort that you can call from Go using some sort of driver.

My personal opinion is that an ORM creates basically an own language you have to learn. But since you have used Graphql in the past, it may be my first choice.

as a result, u recommend PostgreSQL with graphql api for gin, right?

I recommend Postgresql. And the API you are most familiar with.

I have no experience with Gin, but a framework in general is an extra layer that sometimes speeds up and sometimes is limiting. Go has an excellent standard library, making it possible to create apps without using a framework. Just a personal opinion…

1 Like

do you have experience in rest api with pure golang. without framework, if it is ok I can work with golang without framework

At beginner level. Yes. https://crud.go4webdev.org

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