samedi 9 janvier 2016

How can I create MappedColumnType for Map[K, V] type?

Vote count: 0

How can I create MappedColumnType for Map[K, V] type ? I didn't have success with creating generic mapper. But I tried creating mapper for Map[String, String] that is defined like this (for the sake of example only):

implicit val TestColumnType = MappedColumnType.base[Map[String, String], String](
  { obj => obj.toString }, { str => Map[String, String]() }
)

in my Table class column is defined as

def abstrct = column[Option[Map[String, String]]]("abstract")

I get following compilation error

Error:(130, 54) could not find implicit value for parameter tt: slick.ast.TypedType[Option[Map[String,String]]]
    def abstrct = column[Option[Map[String, String]]]("abstract") 
                                                     ^

What am I missing ? My mappers for simple types work fine.

asked 1 min ago

This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at http://ift.tt/jcXqJW.



How can I create MappedColumnType for Map[K, V] type?

Aucun commentaire:

Enregistrer un commentaire