gorm 如何构建 多个字段,任意组合的查询,形如sql where (user_id,type) in ((568,6),(569,6),(600,8))

wanderingpuppy · · 4276 次点击
一般真的没必要用ORM,如果嫌标准库sql麻烦可以使用轻封装的sqlx
#2
更多评论
Justin19960208
Insects awaken soon after the first day of spring.
db.Exec() string拼接使用原语
#1
老哥, gorm 现在有了 db.Where("(name, age, role) IN ?", [][]interface{}{{"jinzhu", 18, "admin"}, {"jinzhu2", 19, "user"}}).Find(&users) // SELECT * FROM users WHERE (name, age, role) IN (("jinzhu", 18, "admin"), ("jinzhu 2", 19, "user"));
#3