Skip to content

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

Open
@stephencelis

Description

@stephencelis

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

  • postgres-nio 1.18.0
  • postgres-kit 2.12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions