Contemplating on my first backend project, I’ve decided to stay off any Framework but and largely use the std or if need be a library (like Chi for my routing).
Coming from Python( and writing a little of FastAPI), I’m okay or always assumed that a query builder is a good option (hardly an ORM). Checking out peoples opinions on recommended query builder from Golang groups and forum, “plain SQL” is much appreciated. Is that the correct way to go?
Hand-writing SQL is always a good way to go. But if you want something for simple CRUD, I’ve used gorm and it does make CRUD a breeze. And it also makes scanning into structs easy. Chi is a great option for routing.
It sounds like you have a good idea of what you’re using to build your project. Build it and ask more specific questions when you have them!
I have used both ORM and Query Builders (not using Go), and my opinion is that they are good as long as you write simple queries. But when you must write more complex queries, there is nothing that beats raw SQL.
And the main reason I do not use ORM is that it is very hard to get help, as the number of users for a specific ORM/Query Builder is a tiny fraction of raw SQL developers. And StackOverflow is a very good source for raw SQL questions.
There is a Go package called Bob. It generates Go code for accessing the database. I like this way because you get autocomplete in the IDE and the basic crud operations are easier.