rename record_printer to RecordPrinter

This commit is contained in:
2026-05-18 13:48:34 +02:00
parent caacdfa34a
commit 60f03246dc
3 changed files with 9 additions and 9 deletions
+43
View File
@@ -0,0 +1,43 @@
#ifndef MATADOR_RECORD_PRINTER_HPP
#define MATADOR_RECORD_PRINTER_HPP
#include "matador/sql/record.hpp"
#include <iosfwd>
#include <map>
namespace matador::sql {
class field;
class record;
}
namespace matador::test {
class RecordPrinter final {
public:
explicit RecordPrinter(std::ostream &os);
void print_header(const sql::record &rec) const;
void print(const sql::record &rec) const;
template < class Type, template <typename ...> class ContainerType >
void print(ContainerType<Type> &records) const {
bool first = true;
for (const auto &rec: records) {
if (first) {
print_header(rec);
first = false;
}
print(rec);
}
}
private:
[[nodiscard]] static int width(const sql::field &f) ;
private:
std::ostream &os_;
std::map<utils::basic_type, int> type_widths_;
};
}
#endif //MATADOR_RECORD_PRINTER_HPP