diff options
author | Vlad Uspensky <v.uspenskiy@icloud.com> | 2017-08-28 09:57:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-28 09:57:06 -0700 |
commit | f7621e318de56865b44a6a07ea45e37bbb3f80c1 (patch) | |
tree | ca6d966182e21d072895f7c32bea2fbc35bc2c23 /src/main/scala/xyz/driver/pdsuicommon/parsers/SortingParser.scala | |
parent | 4512539b01e6e598d494246426b9eac261d10acf (diff) | |
parent | b249515292bfefbb70d1b5743ca46ced6da22a00 (diff) | |
download | rest-query-f7621e318de56865b44a6a07ea45e37bbb3f80c1.tar.gz rest-query-f7621e318de56865b44a6a07ea45e37bbb3f80c1.tar.bz2 rest-query-f7621e318de56865b44a6a07ea45e37bbb3f80c1.zip |
Merge pull request #21 from drivergroup/queryparsers
Added converting camel case to snake case for filters and sorting AST
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuicommon/parsers/SortingParser.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuicommon/parsers/SortingParser.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/scala/xyz/driver/pdsuicommon/parsers/SortingParser.scala b/src/main/scala/xyz/driver/pdsuicommon/parsers/SortingParser.scala index c1c332f..4bfc669 100644 --- a/src/main/scala/xyz/driver/pdsuicommon/parsers/SortingParser.scala +++ b/src/main/scala/xyz/driver/pdsuicommon/parsers/SortingParser.scala @@ -3,6 +3,7 @@ package xyz.driver.pdsuicommon.parsers import xyz.driver.pdsuicommon.db.{Sorting, SortingOrder} import fastparse.all._ import fastparse.core.Parsed +import xyz.driver.pdsuicommon.utils.Utils._ import scala.util.Try @@ -18,8 +19,11 @@ object SortingParser { case (sortingOrder, field) => val prefixedFields = field.split("\\.", 2) prefixedFields.size match { - case 1 => Sorting.Dimension(None, field, sortingOrder) - case 2 => Sorting.Dimension(Some(prefixedFields.head), prefixedFields.last, sortingOrder) + case 1 => Sorting.Dimension(None, toSnakeCase(field), sortingOrder) + case 2 => + Sorting.Dimension(Some(prefixedFields.head).map(toSnakeCase), + toSnakeCase(prefixedFields.last), + sortingOrder) } } } |