-
-
Notifications
You must be signed in to change notification settings - Fork 69
Custom JSON Coders for Postgres Data Coders #159
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
Merged
+55
−22
Merged
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
0a59105
Changed dependencies to Skelpo forks
calebkleveter 28b0663
Conformed PostgresDataDecoder to PostrgesDecoder and PostgresDataEnco…
calebkleveter fa56c71
Added JSON encoder/decoder configurations to PostgresConfiguration in…
calebkleveter e6d4810
Added .encoder and .decoder properties to _ConnectionPoolPostgresData…
calebkleveter c7dce4b
Pass configuration.encoder and .decoder into PostgresConnection.conne…
calebkleveter 0d88de2
Use PostgresRow.decoder to decode data in PostgresRow.decode(column:a…
calebkleveter 61e59f6
Added .encoder and .decoder properties to _PostgresSQLDatabase
calebkleveter 3f7c581
Use .encoder to encode query binds in _PostgresSQLDatabase.execute(sq…
calebkleveter a26d07c
Use .source instead of .sourceInfo propety in _ConnectionPoolPostgres…
calebkleveter 887271a
Merged 'upstream/master' into master
calebkleveter 41cd1c7
Use skeplo/master for PostgresNIO until forks are merged
calebkleveter ed2c6e8
Replaced PostgresRow:SQLRow conformance with .sqlRow(using:) method
calebkleveter 6436a02
Replaced uses of Postgres<Coder> protocols with PostgresData<Coder> t…
calebkleveter 10ba3a2
Use original PostgresNIO library instead of Skelpo fork
calebkleveter 0884bbd
Fixed calls to PostgresConnection.sql(encoder:decoder:) in PostgresKi…
calebkleveter c2bf44a
Deleted Xcode workspace
calebkleveter 0fa2d80
Keep PostgresRow.sqlRow(using:) method internal
calebkleveter 505570e
Removed PostgresConnection.sql() extension method
calebkleveter edb4965
Pass in PostgresData coders instead of JSON coders to PostgresConfigu…
calebkleveter 5b83ae2
Removed leftover PostgresData coder declarations in PostgresConnectio…
calebkleveter f69cdf8
Revert "Keep PostgresRow.sqlRow(using:) method internal"
calebkleveter 55b4524
Use registered JSONEncoder to handle DoJSON case in PostgresDataEncoder
calebkleveter f7d7bb1
Merged 'upstream/master' into master
calebkleveter 83acdea
Added default value to PostgresDataEncoder.init(json:) and PostgresDa…
calebkleveter b4b7380
Renamed PostgresRow.sqlRow(using:) method to .sql(using:)
calebkleveter 388dec1
Replace uses of PostgresRow.sqlRow with .sql
calebkleveter 6eb20b2
Revert all changes made for custom JSON
calebkleveter 17381eb
Add default value to PostgresRow.sql method
calebkleveter 5f96b82
Fix PostgresDataDecoder paramater name for .sql call
calebkleveter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
extension PostgresRow: SQLRow { | ||
public func decode<D>(column: String, as type: D.Type) throws -> D where D : Decodable { | ||
guard let data = self.column(column) else { | ||
extension PostgresRow { | ||
public func sql(using decoder: PostgresDataDecoder) -> SQLRow { | ||
return _PostgreSQLRow(row: self, decoder: decoder) | ||
} | ||
} | ||
|
||
private struct _PostgreSQLRow: SQLRow { | ||
let row: PostgresRow | ||
let decoder: PostgresDataDecoder | ||
|
||
func decode<D>(column: String, as type: D.Type) throws -> D where D : Decodable { | ||
guard let data = self.row.column(column) else { | ||
fatalError() | ||
} | ||
return try PostgresDataDecoder().decode(D.self, from: data) | ||
return try self.decoder.decode(D.self, from: data) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.