如何在GO MYSQL中使用许多相似的参数构造sql?

I am currently using GO MySQL and I have a case where the sql contains many similar parameter.

stmt, err := db.Prepare(`
    SELECT id
    FROM questions
    WHERE description like '%?%'
    UNION
    SELECT id
    FROM books
    WHERE description like '%?%'
    UNION
    SELECT id
    FROM sites
    WHERE description like '%?%'`)

param := "golang"
stmt.Query(param, param, param)

My real life sql has about 10 similar parameters of golang and a 2nd parameter that repeats itself a few times. Is the positional parameter the only way to construct the sql?

You can use the spread operator:

args := make([]string, 0)
for i := 0; i < 10; i++ {
    args = append(args, "param")
}

q.Query(args...)

More lines of code, but at least you don't have to Ctrl+C/Ctrl+V all the time.