NOT NULL查询
WhereIsNotNull()
可通过链式调用的方式来指定多条件的查询
- @param
field
字段名
WhereIsNotNull()
var user []User
err := tg.Db("user").Where("age", 10).WhereIsNotNull("score").Select(&user)
var user []User
err := tg.Db("user").Where("age", 10).WhereIsNotNull("score").Select(&user)
最终的SQL语句为:
SELECT * FROM user WHERE age = 10 AND score IS NOT NULL
SELECT * FROM user WHERE age = 10 AND score IS NOT NULL