-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add optional support for decoding #1224
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
The |
I'm going to take a look to tests, but that's not normal if it fails... (also you might need to add tests to cover your new methods) |
An oversight on my part (too much copypasta).
The |
Sources/SQLite/Typed/Coding.swift
Outdated
func decodeIfPresent<T>(_ type: T.Type, forKey key: Key) throws -> T? where T: Swift.Decodable { | ||
switch type { | ||
case is Data.Type: | ||
if let data = try? row.get(Expression<Data>(key.stringValue)) { |
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.
You can write all those lines as return try? ... as? t
directly
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.
Yeah not sure what was going though my head here
If they are private that means they are not tested at all... that's scary. |
I think I'll open up an issue for it if that's alright? I may still come back and open a PR to close that issue but likely not anytime soon |
Closes #997 by adding support for optional types when decoding a row.