Answer the question
In order to leave comments, you need to log in
How to make a SQL query with a variable number of parameters?
You need to make a SELECT of the form:
SELECT id,age
FROM users
WHERE age=22 [and gender='m' and ...]
Answer the question
In order to leave comments, you need to log in
I've done everything.
It turns out that two closing tags are missing in the header.
It remains to be seen why they disappeared.
The main thing is that it works.
I will remember this lesson for a long time.
form a query in any convenient way, put the data into an array of type
var data []interface{}
and then
if r, err = tx.Query(query, data...
) use the syntax for applying an array as a set of parameters
https://github.com/avelino/awesome-go#database Choose from here under `SQL query builder, libraries for building and using SQL.` the library that suits you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question