stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.57k stars 1.54k forks source link

add decoding for UUID #1137

Closed atultw closed 2 years ago

atultw commented 2 years ago

I stumbled upon issue #1126 while trying to decode a UUID using codable. As described there, encoding worked fine but decoding treated the field like json.

Added an else to cover the UUID case, matching the encode method functionality.

atultw commented 2 years ago

lint should pass now

jberkel commented 2 years ago

Thanks for your contribution. Can you add some tests?

atultw commented 2 years ago

Added a UUID field to TestCodable. I figure that's the best way since it already has fields for date and other types.

I copy pasted apple's example UUID from foundation docs for the tests. May want to make it a constant instead. Let me know what you think!

atultw commented 2 years ago

Thanks Jan. Made the changes, tests passing. I put the uuid constant in TestHelpers, can move it elsewhere if needed

jberkel commented 2 years ago

Ok, looking good, just a few lint fixes left.

atultw commented 2 years ago

Tried splitting the lines that were too long into two lines, but that made the test fail. So I disabled the rule at those spots.