I followed this article to create union types. The articles has few answers about the Primitive type but my scenario is an extension to it.
So, I am trying to define a method which takes Map[String, A] where A is the set of allowed type.
This is my class of union types:
sealed trait SupportedType[A]
object SupportedType {
  implicit val byteBufferColumn : SupportedType[ByteBuffer] = new SupportedType[ByteBuffer] {}
  implicit val longColumn : SupportedType[java.lang.Long] = new SupportedType[java.lang.Long] {}
  implicit val byteArrayColumn : SupportedType[Array[Byte]] = new SupportedType[Array[Byte]] {}
  implicit val stringColumn : SupportedType[String] = new SupportedType[String] {}
}
This is my method I defined:
def upsert[A: SupportedType](key: T, values: Map[String, A], timestamp: Long, ttl: Duration): Future[Unit]
This is how I am calling the method:
dataStore.upsert(
      cacheKey,
      Map(
        itColumn      -> ByteBuffer.wrap(Utils.compress(iti.toByteArray)),
        cacheWriteTimeColumn -> writeTime.toEpochMilli
      ),
      writeTime.toEpochMilli,
      ttl
    )
error: No implicit arguments of type: SupportedType[Any]
My guess is writeTime.toEpochMilli returns java.long type and as you can see in SupportedType, I tried to define java.lang.Long but thats not working.
Any help would be appreciated.
 
    