vapor / postgres-kit

🐘 Non-blocking, event-driven Swift client for PostgreSQL.
MIT License
188 stars 70 forks source link

`PostgresDataConvertible` should not be hard-deprecated till PostgresKit adopts newer APIs #254

Open stephencelis opened 1 year ago

stephencelis commented 1 year ago

Describe the bug

Upon upgrading my dependencies I got a deprecation warning for PostgresDataConvertible, urging me to upgrade to the newer protocols, but when I attempted to upgrade, I got hit with decoding failures for typeMismatch due to SQLRow.decode no longer getting the right type.

To Reproduce

Here are the helpers I'm using, including the conformance at the bottom of the file:

https://github.com/pointfreeco/pointfreeco/blob/63db1dd9a73c6e9f240aebe4a8072b1a725ee1f0/Sources/Database/Helpers.swift

Updating the conformance to the following breaks the helpers above:

extension Tagged: PostgresDecodable where RawValue: PostgresDecodable {
    public init(
        from byteBuffer: inout ByteBuffer,
        type: PostgresDataType,
        format: PostgresFormat,
        context: PostgresDecodingContext<some PostgresJSONDecoder>
    ) throws {
        self.init(
            try RawValue(
                from: &byteBuffer,
                type: type,
                format: format,
                context: context
            )
        )
    }
}

Expected behavior

I expect a deprecation warning pushing me to adopt a new API to be compatible with the existing APIs I adopt from PostgresKit.

Environment

stephencelis commented 1 year ago

(@MahdiBM Helped debug this for me on this Discord.)

MahdiBM commented 1 year ago

I think it's more like a problem on postgres-kit side that we're not properly supporting the new APIs 😅

I'm working on some updates luckily, as mentioned in the conversation: https://github.com/vapor/postgres-kit/pull/253

gwynne commented 1 year ago

I updated PostgresKit to the new APIs a long time ago.

stephencelis commented 1 year ago

@gwynne Can you explain why this was closed outright when my core issue is unresolved? If the issue I opened doesn't explain things well or isn't categorized well we can certainly update it.