Philippe
Philippe

Reputation: 91

Slick to manage Array[byte] in PostgreSQL with Scala

We are having a few issues managing images in the database with Slick. They are stored in a Array[Byte] format. Every source I read informs me it should work, but I keep getting this error:

could not find implicit value for parameter conv: scala.slick.jdbc.GetResult[Array[Byte]]

The compiler is telling me that no mapper is found for Array[Byte]. I must be missing a simple import, but I can't seem to find it.

Upvotes: 3

Views: 1478

Answers (1)

cmbaxter
cmbaxter

Reputation: 35453

You need an implicit GetResult in scope to map from the db result to the Array[Byte] that you want. Try adding the following just before your query:

implicit val GetByteArr = GetResult(r => r.nextBytes)

Upvotes: 3

Related Questions