-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MkPersistSettings option for preserve CamelCase style of composite keys #1421
MkPersistSettings option for preserve CamelCase style of composite keys #1421
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you!
A few notes on the version number. I think I can commit that myself and get this meged+released soon.
spec :: Spec | ||
spec = describe "CompositeKeyStyleSpec" $ do | ||
describe "mpsCamelCaseCompositeKeySelector is False" $ do | ||
it "Should generate Legacy style key selectors" $ do | ||
let key = CompanyUserLegacyStyleKey "cName" "uName" | ||
|
||
constrFields (toConstr key) | ||
`shouldBe` | ||
[ "companyUserLegacyStyleKeycompanyName" | ||
, "companyUserLegacyStyleKeyuserName" | ||
] | ||
describe "mpsCamelCaseCompositeKeySelector is True" $ do | ||
it "Should generate CamelCase style key selectors" $ do | ||
let key = CompanyUserCamelStyleKey "cName" "uName" | ||
|
||
constrFields (toConstr key) | ||
`shouldBe` | ||
[ "companyUserCamelStyleKeyCompanyName" | ||
, "companyUserCamelStyleKeyUserName" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very cool test!
-- ^ Should we generate composite key accessors in the correct CamelCase style. | ||
-- | ||
-- If the 'mpsCamelCaseCompositeKeySelector' value is set to 'False', | ||
-- then the field part of the accessor starts with the lowercase. | ||
-- This is a legacy style. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doc comment is fantastic <3
released! |
Before submitting your PR, check that you've:
@since
declarations to the Haddockstylish-haskell
on any changed files..editorconfig
file for details)After submitting your PR:
(unreleased)
on the ChangelogIn accordance with the #1420 , this PR adds an additional field
mpsCamelCaseCompositeKeySelector
to theMkPersistSettings
.This field can be used to determine whether the entity composite key selectors should continue to match the Legacy style (companyUserKeycompanyId) or match the CameCase style (companyUserKeyCompanyId).