Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 在Slick中使用选项而不是NOTNULL_Scala_H2_Slick - Fatal编程技术网

Scala 在Slick中使用选项而不是NOTNULL

Scala 在Slick中使用选项而不是NOTNULL,scala,h2,slick,Scala,H2,Slick,我有一门课: class Sitestats(tag: Tag) extends Table[(Int,String,String,Int,String)](tag, "SITESTATS"){ def id = column[Int]("STAT_ID", O.PrimaryKey, O.AutoInc) def url = column[String]("STAT_URL") def httpstatus = column[String]("STAT_HTTPSTATUS")

我有一门课:

class Sitestats(tag: Tag) extends Table[(Int,String,String,Int,String)](tag, "SITESTATS"){
  def id = column[Int]("STAT_ID", O.PrimaryKey, O.AutoInc)
  def url = column[String]("STAT_URL")
  def httpstatus = column[String]("STAT_HTTPSTATUS")
  def contentlength = column[Int]("STAT_CONTENTLENGTH")
  def description = column[String]("STAT_DESC")

  def * : ProvenShape[(Int,String,String,Int,String)] = (id,url,httpstatus,contentlength,description)
}
允许我做(使用滑头)

产生预期(snip):

我希望httpstatus能够为null,所以我将行更改为

def httpstatus = column[Option[String]]("STAT_HTTPSTATUS")
导致

[error]  found   : (scala.slick.lifted.Column[Int], scala.slick.lifted.Column[String], scala.slick.lifted.Column[Option[String]], scala.slick.lifted.Column[Int], scala.slick.lifted.Column[String])
[error]  required: scala.slick.lifted.ProvenShape[(Int, String, String, Int, String)]
我遗漏了什么?

尝试如下更新:

def * : ProvenShape[(Int,String,Option[String],Int,String)] = (id,url,httpstatus,contentlength,description)
您忘记更新表定义。:)

更新 尝试如下更新:

def * : ProvenShape[(Int,String,Option[String],Int,String)] = (id,url,httpstatus,contentlength,description)
您忘记更新表定义。:)

更新 尝试如下更新:

def * : ProvenShape[(Int,String,Option[String],Int,String)] = (id,url,httpstatus,contentlength,description)
您忘记更新表定义。:)

更新 尝试如下更新:

def * : ProvenShape[(Int,String,Option[String],Int,String)] = (id,url,httpstatus,contentlength,description)
您忘记更新表定义。:)

更新
在[error]中找到的结果:字符串(“404”)[error]必需:选项[String][error]sitestats+=((234,))在[error]中找到的结果:字符串(“404”)[error]必需:选项[String][error]sitestats+=((234,))在[error]中找到的结果:字符串(“404”)[error]必需:选项[String][error errorsitestats+=((234,))导致[error]找到:字符串(“404”)[error]必需:选项[String][error]sitestats+=((234,))