I'm trying to use scalikejdbc to access schema that contains array field, i.e.
CREATE TABLE foo (
id INTEGER PRIMARY KEY,
events TEXT[] NOT NULL
);
I can't find anything about arrays in documentation or examples, I can only guess by looking at the scalikejdbc sources.
My model looks like
case class Foo(id: Long, events: Array[String])
object Foo extends SQLSyntaxSupport[Foo] with ShortenedNames {
override val columnNames = Seq("id", "events")
private val s = syntax("s")
private def apply(sp: SyntaxProvider[Foo])(rs: WrappedResultSet): Foo = apply(sp.resultName)(rs)
private def apply(rn: ResultName[Foo])(rs: WrappedResultSet): Foo = Foo(
id = rs.get(rn.id),
events = rs.get(rn.events)
)
// ...
}
And compiler complains
erroneous or inaccessible type events = rs.get(rn.events)
^
If I change extractor code to
events = rs.array(rn.events).getArray.asInstanceOf[Array[String]]
It compiles fine, but I get runtime exception
Execution exception[[UnsupportedOperationException: null]]
So how do I access array field using scalikejdbc?