diff options
author | vlad <vlad@driver.xyz> | 2018-02-27 23:54:23 -0800 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2018-02-27 23:54:23 -0800 |
commit | 32fb404ef3d99eb4aa9bc5e25e083bc13f5972dc (patch) | |
tree | 8a124e7977e8456b42909fbd2faa76f461503a6a /src/main/scala | |
parent | 73429797d21eafb2313b977bb7ef2b2aa2db95f4 (diff) | |
download | rest-query-32fb404ef3d99eb4aa9bc5e25e083bc13f5972dc.tar.gz rest-query-32fb404ef3d99eb4aa9bc5e25e083bc13f5972dc.tar.bz2 rest-query-32fb404ef3d99eb4aa9bc5e25e083bc13f5972dc.zip |
Moved findEqFilter herev1.1.5
Diffstat (limited to 'src/main/scala')
-rw-r--r-- | src/main/scala/xyz/driver/restquery/query/SearchFilterExpr.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/restquery/query/SearchFilterExpr.scala b/src/main/scala/xyz/driver/restquery/query/SearchFilterExpr.scala index 8cbf685..ca631fc 100644 --- a/src/main/scala/xyz/driver/restquery/query/SearchFilterExpr.scala +++ b/src/main/scala/xyz/driver/restquery/query/SearchFilterExpr.scala @@ -1,8 +1,21 @@ package xyz.driver.restquery.query +import xyz.driver.restquery.query.SearchFilterBinaryOperation.Eq +import xyz.driver.restquery.query.SearchFilterExpr.{Atom, Dimension} + sealed trait SearchFilterExpr { def find(p: SearchFilterExpr => Boolean): Option[SearchFilterExpr] def replace(f: PartialFunction[SearchFilterExpr, SearchFilterExpr]): SearchFilterExpr + + def findEqFilter(fieldName: String): Option[SearchFilterExpr] = + findEqFilter(Dimension(None, fieldName)) + + def findEqFilter(dimension: Dimension): Option[SearchFilterExpr] = { + this.find { + case Atom.Binary(`dimension`, Eq, _) => true + case _ => false + } + } } object SearchFilterExpr { |