Open
Description
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