Following the readme, I wanted to work with a table that has not id. Therefore, I tried to instantiate a Repo[MyTableCreator, MyTable, Null], but I got two compile errors:
First, missing an implicit ClassTag[Null]:
[error] | /* missing */summon[scala.reflect.ClassTag[Null]])
[error] |
[error] |But no implicit values were found that match type scala.reflect.ClassTag[Null]
[error] |
[error] |where: derived$DbCodec is a given instance in object Creator
[error] | derived$DbCodec² is a given instance in object Foo
[error] | magnum is a package in package com.augustnagro
[error] | magnum² is a package in package kicks.db
Then a missing DbCodec[Null] (we can maybe improve the error message in the future):
[error] |java.util.NoSuchElementException: None.get
[error] | at scala.None$.get(Option.scala:627)
[error] | at scala.None$.get(Option.scala:626)
[error] | at com.augustnagro.magnum.RepoDefaults$.genImpl(RepoDefaults.scala:47)
[error] | at com.augustnagro.magnum.RepoDefaults$.inline$genImpl(RepoDefaults.scala:39)
My current workaround:
given scala.reflect.ClassTag[Null] = new scala.reflect.ClassTag[Null] { def runtimeClass = classOf[Null] }
given DbCodec[Null] with {
val cols = IArray(java.sql.Types.NULL)
def readSingle(rs: java.sql.ResultSet, pos: Int) = null
def writeSingle(a: Null, ps: java.sql.PreparedStatement, pos: Int) = ()
def queryRepr = "NULL"
}
Is this expected or am I missing something in the setup?
Following the readme, I wanted to work with a table that has not
id
. Therefore, I tried to instantiate aRepo[MyTableCreator, MyTable, Null]
, but I got two compile errors:First, missing an implicit
ClassTag[Null]
:Then a missing
DbCodec[Null]
(we can maybe improve the error message in the future):My current workaround:
Is this expected or am I missing something in the setup?
Using scala 3.4.1 and magnum 1.1.1.