Skip to content

Problem getting query metadata from a PostgresClient query #525

@neilt

Description

@neilt

I am trying to find a way to access the query metadata from a PostgresClient query. The following code fails on the return statement which should return the number of rows deleted. I cannot seem to find a workaround. Is there a way to access the query metadata.

    static func deleteFromTable(client: PostgresClient, columnValue: String, columnName: String) async throws -> Int {
        var myBindings = PostgresBindings()
        myBindings.append(PostgresData(string: tableName))
        myBindings.append(PostgresData(string: columnName))
        myBindings.append(PostgresData(string: columnValue))
        let myQuery = PostgresQuery(unsafeSQL: #"DELETE FROM $1 WHERE $2 = $3;"#,
                                    binds: myBindings)
        let rows = try await client.query(myQuery).collect()
        return rows.metadata.rows // <- fails Value of type '[PostgresRow]' has no member 'metadata'
    }

Postgres-nio 1.22.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions