slick-pg icon indicating copy to clipboard operation
slick-pg copied to clipboard

Missing Driver Action

Open bearrito opened this issue 9 years ago • 3 comments

My driver definition is below.

When I try to use delete I receive the folllowing compiler error.

Error:(72, 12) type mismatch;
 found   : trafficland.commons.slick.ExtendedPostGresDriver.DriverAction[Int,slick.dbio.NoStream,slick.dbio.Effect.Write]
    (which expands to)  slick.profile.FixedSqlAction[Int,slick.dbio.NoStream,slick.dbio.Effect.Write]
 required: slick.dbio.DBIOAction[Boolean,slick.dbio.NoStream,Nothing]
    db.run(invoker)
           ^
package trafficland.commons.slick

import java.net.URI
import com.github.tminglei.slickpg._


object ORIENTATIONS extends Enumeration {
  type Orientation = Value
  val NORTH,SOUTH,EAST,WEST,NORTHEAST,SOUTHEAST,SOUTHWEST,NORTHWEST,UNKNOWN= Value
}

trait ExtendedPostGresDriver
  extends ExPostgresDriver
  with PgArraySupport
  with PgDateSupport
  with PgDate2Support
  with PgPostGISSupport
  with PgEnumSupport
{


  override val api = MyAPI

  object MyAPI
    extends API
    with ArrayImplicits
    with DateTimeImplicits
    with PostGISImplicits
    with PostGISAssistants
  {

    implicit val uriColumnType = MappedColumnType.base[java.net.URI, String](
    { u => u.toString},
    { t => new URI(t)}
    )

    implicit val orientationTypeMapper = createEnumJdbcType("orientation", ORIENTATIONS)
    implicit val stringVectorTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toVector)
    implicit val intVectorTypeMapper = new SimpleArrayJdbcType[Int]("int").to(_.toVector)
  }

}

object ExtendedPostGresDriver extends ExtendedPostGresDriver

I saw this question : https://github.com/tminglei/slick-pg/issues/174, but I did not have extra implicit import so it didn't help me.

bearrito avatar Aug 14 '15 18:08 bearrito

Hi @bearrito, why did you mix in both PgDateSupport and PgDate2Support?

If you need them both, why not use SimpleDateTimeImplicits or Date2DateTimeImplicitsDuration instead of DateTimeImplicits?

tminglei avatar Aug 15 '15 04:08 tminglei

I remove the PgDateSupport import, but I'm still not having any luck on getting the delete action. What other information can I provide to sort this out?

Is it related to - https://github.com/playframework/play-slick/issues/249?

bearrito avatar Aug 15 '15 18:08 bearrito

Hi @bearrito, you didn't paste the real wrong codes here.

As the error message said:

Error:(72, 12) type mismatch;
 found   : trafficland.commons.slick.ExtendedPostGresDriver.DriverAction[Int,slick.dbio.NoStream,slick.dbio.Effect.Write]
    (which expands to)  slick.profile.FixedSqlAction[Int,slick.dbio.NoStream,slick.dbio.Effect.Write]
 required: slick.dbio.DBIOAction[Boolean,slick.dbio.NoStream,Nothing]
    db.run(invoker)
           ^

It required a slick.dbio.DBIOAction[Boolean,slick.dbio.NoStream,Nothing], but you gave it a slick.dbio.DBIOAction[Int,slick.dbio.NoStream,slick.dbio.Effect.Write].

If you still can't find the point, pls paste the usage codes here, to help me know what exactly happened.

tminglei avatar Aug 15 '15 23:08 tminglei