新手求助,gorm遇到一个查询问题,麻烦请各位帮忙看看,谢谢!

wxxul0608 · · 756 次点击
之前试过了,不能用not in 。比如这里你name not in ( 'zhangsan' ) age not in ( '10' )。他会过滤掉另外一条name : zhangsan,age:19的这一条。后面发现where not (name = zhangsan and age = 19) 这样可以,但是过滤条件是动态的可能会有很多条,就不知道gorm里面可以怎么使用才能达到要求。
#2
更多评论
用in应该可以叭, where name not in ('111','222') and age not in (19 , 10)
#1
用函数把name和age拼接起来,再当做查询条件。
#3