Closed pismute closed 6 years ago
Try define it inside another sub project
@jilen Thank you so much.
It's just 4 lines. I don't want to create another sub product. Is there another option?
I think io.getquill.util.LoadObject
can't load MySchema object. It seems Class.forName("xxx.MySchema$")
statement is failing:
package io.getquill.util
import scala.reflect.macros.whitebox.Context
import scala.util.Try
object LoadObject {
def apply[T](c: Context)(tpe: c.Type): Try[T] =
Try {
val cls = Class.forName(tpe.typeSymbol.fullName + "$")
val field = cls.getField("MODULE$")
field.get(cls).asInstanceOf[T]
}
}
BTW, How can I debug Scala macros?
@pismute The current LoadObject
implementation requires that. Otherwise the custom NamingStrategy
might not available to be loaded.
Because Class.forName
requires the target class available on classpath
Thank you a lot
How can I implement custom
NamingStrategy
working at compile time.Version:
0.4.3-SNAPSHOT
Module:quill-async-postgres
Database:postgres
I created a custom NamingStrategy because
postgres-async
doesn't support current schema concept, which is used byquill-async-postgres
:It works at runtime only, not at compile time.
And I have put the NamingStrategy into quill and built my quill version. It works at compile time as I expected.
How can I use my custom NamingStrategy as static?