You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question about prepare query contains 'where in', here is my code:
stmt, err := db.Prepare("select user_id from user where user_id in ?")
I've tried these four ways:
// 1
stmt, err := db.Prepare("select user_id from user where user_id in ?")
rows, _ := stmt.Query(1, 11)
// 2
stmt, err := db.Prepare("select user_id from user where user_id in ?")
rows, _ := stmt.Query([]int{1, 11})
// 3
stmt, err := db.Prepare("select user_id from user where user_id in (?)")
rows, _ := stmt.Query(1, 11)
// 4
stmt, err := db.Prepare("select user_id from user where user_id in (?)")
rows, _ := stmt.Query([]int{1, 11})
all of them four got a panic like:
panic: runtime error: invalid memory address or nil pointer dereference
could you please give me a hand, if you could provide a example about that will be best
thank you.
The text was updated successfully, but these errors were encountered:
Hi,
I have a question about prepare query contains 'where in', here is my code:
I've tried these four ways:
all of them four got a panic like:
could you please give me a hand, if you could provide a example about that will be best
thank you.
The text was updated successfully, but these errors were encountered: