Slick error while compiling table definitions: could not find implicit value for parameter tm
Asked Answered
B

2

5

I am completely new to Slick. I am trying to create a basic table type, but it just doesn't compile. Here's my code:

import scala.slick.driver.PostgresDriver._
import scala.slick.lifted.Tag
import scala.slick.lifted.Column
import scala.slick.lifted.ProvenShape

class Documents(tag: Tag) extends Table[(Long, String, String)](tag, "DOCUMENTS") {
       def id: Column[Long] = column[Long]("ID", O.PrimaryKey)
       def `type`: Column[String] = column[String]("TYPE")
       def data: Column[String] = column[String]("DATA")

       def * : ProvenShape[(Long, String, String)] = (id, `type`, data)
}

And I get these errors:

<console>:13: error: could not find implicit value for parameter tm: scala.slick.ast.TypedType[Long]
              def id: Column[Long] = column[Long]("ID", O.PrimaryKey)
                                           ^
<console>:14: error: could not find implicit value for parameter tm: scala.slick.ast.TypedType[String]
              def `type`: Column[String] = column[String]("TYPE")
                                                   ^
<console>:15: error: could not find implicit value for parameter tm: scala.slick.ast.TypedType[String]
              def data: Column[String] = column[String]("DATA")
                                                 ^
Brumby answered 27/3, 2015 at 14:28 Comment(0)
B
9

Slick 2

OK, I've solved it while writing the question. Use

import scala.slick.driver.PostgresDriver.simple._

instead of

import scala.slick.driver.PostgresDriver._


UPDATE: thanks to @lost_trekkie

for Slick 3 use:

import slick.driver.PostgresDriver.api._


UPDATE: thanks to Dmytro Mitin

In Slick 3.2 slick.driver.PostgresDriver is deprecated, slick.jdbc.PostgresProfile should be used instead:

import slick.jdbc.PostgresProfile.api._

Brumby answered 27/3, 2015 at 14:28 Comment(1)
In 3.2 slick.driver.PostgresDriver is deprecated, slick.jdbc.PostgresProfile should be used instead: import slick.jdbc.PostgresProfile.api._Bryna
R
4

FYI, with Slick 3, the above mentioned import should be

 import slick.driver.PostgresDriver.api._
Roca answered 11/7, 2016 at 14:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.