How do I manage maybe 1000 SQL-queries in a Golang REST API?
My SQL experience is at the upper basic level using Postgresql. I am today using a tool that you can use plain SQL as well as sort of ORM to direct access the database. The aim of using ORM is to make simpler, but with complex queries it really makes it harder. So I prefer using plain SQL and want to avoid GORM or similar.
When it comes to Golang, my experience is at the early beginners level. I have done a simple REST API with about 5 queries. And it is manageable.
All Golang REST API examples are at the Hello World level. But I need a way to handle several hundreds structs and queries. Easy to code and easy to understand and maintain. And I have so far found 3 ways to do this.
Store the queries using templates or similar.
Use 1000 packages. But this seems to be unmanageable to me.
Store the queries together with the struct in a lookup Postgresql database. Fetch the desired query and fire the query. This will be easy to maintain, but adds another layer that may impact speed.
Besides these thoughts, I have tried a dynamic approach with no luck.
I wonder if anyone that run into this can share some thoughts and advises?