저는 스칼라와 ScalaQuery를 처음 사용하여 몇 주를 사용했습니다. 함수를 호출하여 쿼리의 조건을 파악하려고하지만 T 대신 NamedColumn [T]을 얻습니다. 어떻게 풀어야합니까? https://gist.github.com/3469291ScalaQuery에서 for 루프의 조건으로 NamedColumn의 압축을 풉니 다.
테이블 개체 : https://gist.github.com/3469291
case class MyObject (
id: Long,
created: JodaTime
modified: JodaTime
special: JodaTime
)
object MyObjects extends Table[MyObject]("my_objects") {
lazy val database = Database.forDataSource(DB.getDataSource())
def id = column[Long]("id", O PrimaryKey, O AutoInc, O NotNull)
def created = column[JodaTime]("created", O NotNull)
def modified = column[JodaTime]("modified", O NotNull)
def special = column[JodaTime]("special", O NotNull)
def * = id ~ created <> (MyObject, MyObject.unapply _)
def getMarker(time: JodaTime) = database.withSession { implicit db:Session =>
(for {
e <- MyObjects if (new org.joda.time.Interval(e.created, e.modified).contains(e.special)
} yield (e.id, e.created)).firstOption
}
}
e.created/수정/특별 NamedColumns, 그래서 생성자와 functioncall typemapper와
패키지 :
2 차 링크, 라인 (20)을 참조하십시오 작동하지 않습니다. 이 작업을 어떻게 수행합니까?
나는 내 물건을 시험하지 않았고, 나는 단지 수업을 움켜 쥐고 물건의 이름을 바꾸었지만, 내가 갖고있는 것을 보여 주기만했다.
감사합니다.