From 0bd7ac9563fe04ccbbdd560cbe5a2cf7ccd8962b Mon Sep 17 00:00:00 2001 From: Balaji Sonachalam Date: Wed, 23 Oct 2019 15:51:31 +0200 Subject: [PATCH] #1678 Dynamic query DSL updated Added an extra method to support `String` properties. --- .../src/main/scala/io/getquill/dsl/DynamicQueryDSL.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/quill-core/src/main/scala/io/getquill/dsl/DynamicQueryDSL.scala b/quill-core/src/main/scala/io/getquill/dsl/DynamicQueryDSL.scala index 10583197c2..53e5a6d69a 100644 --- a/quill-core/src/main/scala/io/getquill/dsl/DynamicQueryDSL.scala +++ b/quill-core/src/main/scala/io/getquill/dsl/DynamicQueryDSL.scala @@ -88,6 +88,12 @@ trait DynamicQueryDsl { case Some(v) => setValue(property, v) case None => DynamicSetEmpty() } + + def setOpt[T, U](property: String, value: Option[U])(implicit enc: Encoder[U]): DynamicSet[T, U] = + value match { + case Some(v) => setValue(property, v) + case None => DynamicSetEmpty() + } def set[T, U](property: String, value: Quoted[U]): DynamicSet[T, U] = set((f: Quoted[T]) => splice(Property(f.ast, property)), value)