I needed WITH RECURSIVE in a project recently so I monkey patched this in and it works great 👌, figured I'd help out the upstream.
I noticed the other PR tried to handle the UNION ALL automatically for the recursive section, but in my case I actually wanted just a UNION. I think simply having this method add the RECURSIVE keyword is the way to go since it's trivial to do the .union(...) or .unionAll(...) or whatever one needs in the query section of the .withRecursive() method.
Future improvements might include a raw version, but I think getting this added in its simplest form is an easy win.
I was simply refactoring this to be used in both with* methods. I've noticed template aren't used in most of this codebase and I assumed this was support older JS interpreters. If you're saying template strings are fine I'll update.
Only thing to comment from me would be to have integration test making sure that those queries are actually doing what they are meant to do (verifies that written syntax won't get broken even in the future). Looks great though 👍
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.