有人可以告诉我如何使用光滑的提升嵌入将表列与NULL进行比较.
我想在mysql中实现的目标:
select * from Users where email = '<some_email_addr>' and ( removed = NULL OR removed <= 1 )
Run Code Online (Sandbox Code Playgroud)
当我尝试时,它在x.removed === null时给出了错误:
val q = for {
x <- Users
if x.email === email && ( x.removed === null || x.removed <= 1 )
} yield x.removed
Run Code Online (Sandbox Code Playgroud)
谢谢
cmb*_*ter 16
尝试:
x.removed.isNull
Run Code Online (Sandbox Code Playgroud)
我认为这就是你要找的东西
小智 7
正如daaatz所说,并且您应该使用http://slick.typesafe.com/doc/2.1.0/upgrade.html#isnull-and-isnotnullisEmpty,但它仅适用于Option列.解决方法是x.removed.?.isEmpty.