I am trying to have a query that will be something like this:
SELECT * 
FROM some_table 
WHERE $1 = $2
I am using sqlc to generate everything needed to execute the query so I don't have the option the use a formatted string.
I was also trying to do it this way
SELECT * 
FROM some_table
WHERE 
    CASE 
        WHEN $1 = "name"
            THEN name
            ELSE id
    END = $2;
But could not find a way to make it work right
Is there any way to do something like this?
Thanks you!
 
    