REST API with 1000 query templates

I am not consider myself a beginner with SQL. Only with Golang. I want to RESTify an existing system and have no examples to share 1000 query templates - yet. I am in the phase of choosing method to handle tons of queries. I both need and want to do this in a maintainable way.

A wild guess: Every query with structs may take 20 lines of code or more. Maybe 20 K lines of code or even more. Searching, maintain and deploying this for some decade to come is a challenge. And I want to choose as correct way as possible.

So I am thankful for any input that make me choose a path.