Skip to content

Commit

Permalink
introduce ExecutionPath.cacheKeyReversedIterator
Browse files Browse the repository at this point in the history
same API as in sangria 2.x: #781
It will allow to optimize sangria-slow-logs
  • Loading branch information
yanns committed Nov 3, 2021
1 parent 21d83e0 commit 40ef50a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ExecutionPath private (

def cacheKey: ExecutionPath.PathCacheKey = cacheKeyPath.reverseIterator.toVector
def cacheKeyReversed: ExecutionPath.PathCacheKeyReversed = cacheKeyPath
def cacheKeyReversedIterator: Iterator[String] = cacheKeyPath.iterator

override def toString: String = _path.reverseIterator
.foldLeft(new StringBuilder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ class DeprecationTrackerSpec
deprecationTracker.ctx.get.path.path should be(Vector("nested", "aa", "bb"))
deprecationTracker.ctx.get.path.cacheKey should be(
Vector("nested", "TestType", "aa", "TestType", "bb", "TestType"))
deprecationTracker.ctx.get.path.cacheKeyReversed should be(
List("TestType", "bb", "TestType", "aa", "TestType", "nested"))
deprecationTracker.ctx.get.path.cacheKeyReversedIterator.toList should be(
List("TestType", "bb", "TestType", "aa", "TestType", "nested"))
deprecationTracker.ctx.get.field.name should be("deprecated")
deprecationTracker.ctx.get.parentType.name should be("TestType")
}
Expand Down

0 comments on commit 40ef50a

Please sign in to comment.