implicit def LocalDateTimeMapper: BaseColumnType[LocalDateTime] =
MappedColumnType.base[LocalDateTime, Timestamp](
x => Timestamp.valueOf(x),
x => x.toLocalDateTime
)
implicit def MyTypeMapper: BaseColumnType[MyType] =
MappedColumnType.base[MyType, Timestamp](
x => Timestamp.valueOf(x.value),
x => MyType(x.toLocalDateTime)
)
Hi all! Multi part question for y'all.
1) In a function where I have a scalar array parameter p
of type Rep[List[X]]
, what's the "preferred" way of turning this into a Query[X, Rep[X], Seq
? It isn't just p.unnest
, apparently, which has type Rep[X]
.
Looking at examples, it looks like Query(true).map(_ => p.unnest)
, which does have the right signature (albeit is a little weird).
2) Let's say i have 2 array parameters p1
and p2
of the same cardinality. I want "a zip join of the unnested arrays". Pairs (a, b)
where a
from p1
, and b
from p2
, where the indices for a
and b
match. How should i do this? Hint - It's not:
Query(true).map(_ => p1.unnest).zip(Query(true).map(_ => p2.unnest))
since this leads to a rather surprising sql behavior (at least on postgres) related to the ROW_NUMBER
function being used for the zip join.
WITH ORDINALITY
https://www.postgresql.org/docs/current/static/functions-srf.html
PgDate2Support
is availabe for slick 3.1.1 as an addon, you can use libraryDependencies += "com.github.tminglei" %% "slick-pg_date2" % "0.14.6"
to refer it. But in master for slick 3.2, I merged it into the main jar.
select ARRAY(select stringfield from foos)
yet.
When I'm trying to use slick-pg driver (https://pastebin.com/Z3XeXVSJ; as you can see: there is nothing special with it), I get AbstractMethodError
on Scala 2.12.2:
java.lang.AbstractMethodError: Method ru/makkarpov/play/database/DatabaseProfile$MyAPI$.slick$basic$BasicProfile$API$_setter_$Database_$eq(Ljava/lang/Object;)V is abstract
I'm suppose that this is a compiler bug, but I wondered that Googling for this error shows literally nothing.