Skip to content

Commit

Permalink
zio#1678 Dynamic query DSL updated
Browse files Browse the repository at this point in the history
Added an extra method to support `String` properties.
  • Loading branch information
itachi3 authored Oct 23, 2019
1 parent 165d47f commit 0bd7ac9
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0bd7ac9

Please sign in to comment.