-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Add PostgresQuery #223
Add PostgresQuery #223
Conversation
@@ -26,7 +26,7 @@ public typealias PostgresFormatCode = PostgresFormat | |||
|
|||
/// The data type's raw object ID. | |||
/// Use `select * from pg_type where oid = <idhere>;` to lookup more information. | |||
public struct PostgresDataType: RawRepresentable, Equatable, CustomStringConvertible { | |||
public struct PostgresDataType: RawRepresentable, Hashable, CustomStringConvertible { |
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.
@gwynne We extend public API here!
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.
Fine by me 🙂
3b66f7b
to
3af6209
Compare
Codecov Report
@@ Coverage Diff @@
## main #223 +/- ##
==========================================
+ Coverage 38.62% 43.19% +4.57%
==========================================
Files 120 121 +1
Lines 9271 9322 +51
==========================================
+ Hits 3581 4027 +446
+ Misses 5690 5295 -395
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Postgres compiles Fix tests
3af6209
to
4a2b050
Compare
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.
I have no problems with this as it stands on its own, though it may need some tweaking to be ideal for SQLKit/FluentKit interop, mostly in terms of the serialization of positional parameters. That can be addressed later, though.
@@ -26,7 +26,7 @@ public typealias PostgresFormatCode = PostgresFormat | |||
|
|||
/// The data type's raw object ID. | |||
/// Use `select * from pg_type where oid = <idhere>;` to lookup more information. | |||
public struct PostgresDataType: RawRepresentable, Equatable, CustomStringConvertible { | |||
public struct PostgresDataType: RawRepresentable, Hashable, CustomStringConvertible { |
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.
Fine by me 🙂
Motivation
Right now we encode bindings right before we send them out, in
PSQLFrontendMessageEncoder
. This means that a JSONEncoder must be set per connection. This is not an ideal design. Further we need to wrap the values that we want to bind in an existential[PSQLEncodable]
.I propose changing this API and introducing an explicit
PostgresQuery
type, that isExpressibleByStringInterpolation
.Changes
PostgresQuery
PostgresBindings
PostgresJSONEncoder
fromPSQLFrontendMessageEncoder
Result