Allow a prefix for ?? placeholders#1018
Merged
parsonsmatt merged 6 commits intomasterfrom Jan 28, 2020
Merged
Conversation
parsonsmatt
commented
Jan 28, 2020
|
|
||
| it "commit/rollback" $ do | ||
| caseCommitRollback runDb | ||
| runDb cleanDB |
Collaborator
Author
There was a problem hiding this comment.
this was a mix of 2 space and 4 space indent :| Fixed it here, but it gives a noisy diff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before submitting your PR, check that you've:
@sincedeclarations to the HaddockAfter submitting your PR:
OK, so this is going to be trickier than it should be. The code that actually does the name prefixing is here:
So we arrive at
namefrom theentityDef, and then we immediately collapse that information into a concatenated string. We don't have a good hook to intercept this.A possible solution is a
newtype:This would require the user to write:
I'm not super pleased with this, but it's a drop-in solution that doesn't require modifying any existing code.
Another option is to parse the column substitutions returned from this and re-splice the desired prefix. Kind of gross, but it should work seamlessly -
replace (escape entityName) (escape desiredPrefix) columnSubstitutions. How do we get the desired name, though?Currently, the implementation splits on
??, performs substitution, and then rejoins:If we take
T.unconson the text, and that is a., then we should be able to dig out the previous few characters from it and pick that as the desired name. This will need to respect escaping etc so it's not going to be trivial to write the code to capture it. But a good first pass can merely require that it's an "easy" identifier.This is a bit nasty, but it's not a breaking change and doesn't require any newtype wrangling.
Fixes #1017