-
Notifications
You must be signed in to change notification settings - Fork 113
Added DynamoDB Event #65
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
Conversation
92ad4f2
to
2251364
Compare
9f5778d
to
92513f9
Compare
|
||
extension DynamoDB { | ||
public struct Decoder { | ||
@usableFromInline var userInfo: [CodingUserInfoKey: Any] = [:] |
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.
@usableFromInline needed?
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.
if we want to have this call inlined: yes
@inlinable public func decode<T: Decodable>(_ type: T.Type, from value: AttributeValue)
throws -> T
{
let decoder = _DecoderImpl(userInfo: userInfo, from: value, codingPath: [])
return try decoder.decode(T.self)
}
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.
right, I had a conversation with @weissi a while back on the effectiveness of @inlinable in certain uses case. he may have an opinion here as well
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.
In this case, it's the right call because it's generic and we may be able to inline enough for the whole thing to get specialised. I doubt it'll actually fully work in this case but that's not a good reason not to try.
As a thought for Lambda though: You may just want to recommend -Xswiftc -cross-module-optimization
which then makes all those @inlinable
/@usableFromInline
s superfluous.
} | ||
} | ||
|
||
@usableFromInline internal struct _DecoderImpl: Swift.Decoder { |
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.
a bit of duplication between the different containers, tho not sure if worth making DRYer. your call.
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.
one question for @weissi re inlining, otherwise LGTM
motivation: support DynamoDB triggers changes: added DynamoDB Event abstractions and encoders/decoders
No description provided.