userver icon indicating copy to clipboard operation
userver copied to clipboard

postgres::Row::operator[]

Open SidorovichPavel opened this issue 1 year ago • 1 comments

postgres::Row::operator[] accepts a const std::string& as an argument. A more idiomatic approach would be to accept a std::string_view instead, as implemented in userver for json and e.t.

SidorovichPavel avatar Feb 23 '24 13:02 SidorovichPavel

Row::operator[](const std::string&) eventually ends up in PQfnumber which expects a null-terminated string, so for now there's no way to improve the interface, unfortunately.

However, we are planning to vendor libpq at some point, and when it happens we could add a PQfnumber overload which accepts a string size.

itrofimow avatar Feb 25 '24 09:02 itrofimow