I have the following list of parameters:
params := [(p_1, m_1), ..., (p_n, m_n)] // p_i, m_i : int
Now I want to build a query which go trough the list and match parmeters: (the part after for is a pseudocode which I want to write in PostgreSQL 9.4)
SELECT * FROM X WHERE p = p_i AND m = m_i for (p_i, m_i) in params
How to write this query in Go (using jmoiron.github.io/sqlx or standard database/sql
)?
type Param struct {
P, M int
}
params := []Param{{1,2}, {3,4}}
// ???