-
Notifications
You must be signed in to change notification settings - Fork 55
feat: refresh converter interfaces #1731
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
base: feat-ddb-mapper-main
Are you sure you want to change the base?
Conversation
|
A new generated diff is ready to view.
|
|
A new generated diff is ready to view.
|
|
|
||
|  | ||
|
|
||
| Collection converters are typically build using factory functions which accept one or more delegate converters as |
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.
Correctness: build -> built
| val byteToLong: Converter<Byte, Long> = byteToShort + shortToInt + intToLong | ||
| ``` | ||
|
|
||
| ### Element mapping |
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.
Nit: The Element mapping section is missing an example of a ListMappingConverter implementation
| @@ -0,0 +1,146 @@ | |||
| # HLL Converters | |||
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 is a really cool write up!
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.
Nit: On naming (ListMappingConverter and the rest of the collection converters). Adding an s at the end of the file name to prevent people for looking for xConverter and xMonoConverter in different files.
| if (existingImport == null) { | ||
| imports += ImportDirective("${type.pkg}.${type.baseName}") | ||
| } else if (existingImport.fullName != type.fullName) { | ||
| } else if (existingImport.fullName != "${type.pkg}.${type.baseName}") { |
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.
Question: Why this change?
Issue #
#472
Description of changes
This PR refactors the converter interfaces used in DynamoDB Mapper to improve their semantics, composability, and reusability based on learnings from Dev Preview. Notable improvements:
Item/AttributeValueinstances).+/plusoperator rather thanandThenTowhich also inaccurately conveyed unidirectionality.SplittingConverterwhich was a confusing and overly-complex construct. Also removed the related classEither.ItemConverterorValueConverterto disambiguate the type of object handled.ItemConverterno longer contains a conversion overload for limiting the set of attributes to be converted, which is now handled exclusively byItem.intersectKeys.ItemConverteris now a straightforwardtypealias ItemConverter<T> = Converter<T, Item>.Review guide
There are a lot of changes in this PR but many are renames and moves. I'd advise skimming the codegen changes but paying more attention to changes in :hll-mapping-core and :dynamodb-mapper. In particular, I recommend proceeding in this fashion:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.