Use query builder for constructing dynamic SQL queries

As a follow-up for discussion in #1054 (comment 2025346693) I have created an MR that introduces a very simple query builder. The team reviewed it and accepted it so this issue tracks this work and all the subsequent refactorings of our dynamic SQL queries.

Queries to refactor:

  • in registry/datastore/repository.go
    • tagsDetailPaginatedQuery
    • HasTagsAfterName
    • HasTagsBeforeName
Edited by Pawel Rozlach