diff options
author | Aleksandr <ognelisar@gmail.com> | 2017-10-24 11:35:29 +0700 |
---|---|---|
committer | Aleksandr <ognelisar@gmail.com> | 2017-10-24 11:35:29 +0700 |
commit | a0fe954d3680541de1ff8e0e7a5d762352e90072 (patch) | |
tree | 9fdeee0054f1fcf5c61407d29b1b2d24e4509f94 /src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala | |
parent | 3c2a7fdfccc87cb8ec9e8e48c31c622555078c54 (diff) | |
parent | 5a6b7a7a3013035d692eb6d8ac369c1eb6dac0f3 (diff) | |
download | rest-query-a0fe954d3680541de1ff8e0e7a5d762352e90072.tar.gz rest-query-a0fe954d3680541de1ff8e0e7a5d762352e90072.tar.bz2 rest-query-a0fe954d3680541de1ff8e0e7a5d762352e90072.zip |
Merge branch 'master' into PDSUI-2330
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala b/src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala index dc03a52..7d2f085 100644 --- a/src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala +++ b/src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala @@ -6,6 +6,7 @@ import java.time.LocalDateTime import slick.jdbc.{JdbcProfile, PositionedParameters, SQLActionBuilder, SetParameter} import xyz.driver.pdsuicommon.db.Sorting.{Dimension, Sequential} import xyz.driver.pdsuicommon.db.SortingOrder.{Ascending, Descending} +import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} import scala.concurrent.{ExecutionContext, Future} @@ -44,6 +45,18 @@ object SlickQueryBuilder { pp.setObject(v, JDBCType.BINARY.getVendorTypeNumber) } } + + implicit def setLongIdQueryParameter[T]: SetParameter[LongId[T]] = SetParameter[LongId[T]] { (v, pp) => + pp.setLong(v.id) + } + + implicit def setStringIdQueryParameter[T]: SetParameter[StringId[T]] = SetParameter[StringId[T]] { (v, pp) => + pp.setString(v.id) + } + + implicit def setUuidIdQueryParameter[T]: SetParameter[UuidId[T]] = SetParameter[UuidId[T]] { (v, pp) => + pp.setObject(v.id, JDBCType.BINARY.getVendorTypeNumber) + } } final case class SlickTableLink(keyColumnName: String, foreignTableName: String, foreignKeyColumnName: String) |