Convert int array to string separated by ','
<p>I know that for string array <code>[]string</code> I can use <code>strings.Join(a []string, ',')</code> but I want to do the same thing for an integer array <code>[]int</code>.</p>

<p>My usecase is something like this for a query where <code>variants</code> is <code>[]map[string]int</code> </p>

<pre><code> var Ids []int
    sqlStr := "select id from mapping where my_id in ("
    for _, mp := range variants {
       sqlStr += "?,"
       Ids = append(Ids, mp["id"])
    }
    sqlStr = strings.TrimRight(sqlStr, ",")
    rows, err := db.Query(sqlStr+")", strings.Join(Ids, ',')) // I can't do this because Join needs String array
</code></pre>

<p>How to achieve this?</p>