You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
staticfunc deleteFromTable(client:PostgresClient, columnValue:String, columnName:String)asyncthrows->Int{varmyBindings=PostgresBindings()
myBindings.append(PostgresData(string: tableName))
myBindings.append(PostgresData(string: columnName))
myBindings.append(PostgresData(string: columnValue))letmyQuery=PostgresQuery(unsafeSQL:#"DELETE FROM $1 WHERE $2 = $3;"#,
binds: myBindings)letrows=tryawait client.query(myQuery).collect()return rows.metadata.rows // <- fails Value of type '[PostgresRow]' has no member 'metadata'
}
Postgres-nio 1.22.1
The text was updated successfully, but these errors were encountered:
What you need is #504.
Basically, yes, PostgresNIO currently does not expose the metadata at all, in those functions.
cc @fabianfett I'd assume you're not super happy with the API design in that PR? I'm not either, but I couldn't think of any better ways. I'm open to your guidance if you have better ideas around how to expose the query metadata.
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.
Postgres-nio 1.22.1
The text was updated successfully, but these errors were encountered: