schema: Improve column_definition operator<< output

Make operator<< for column_definition print more information.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
Pekka Enberg
2015-08-31 13:16:47 +03:00
parent 61d7e8de1c
commit ae9e3e049c
2 changed files with 13 additions and 3 deletions

View File

@@ -232,6 +232,18 @@ column_definition::column_definition(bytes name, data_type type, column_kind kin
: _name(std::move(name)), type(std::move(type)), id(component_index), kind(kind), idx_info(std::move(idx))
{}
std::ostream& operator<<(std::ostream& os, const column_definition& cd) {
os << "ColumnDefinition{";
os << "name=" << cd.name_as_text();
os << ", type=" << cd.type->name();
os << ", kind=" << to_sstring(cd.kind);
os << ", componentIndex=" << (cd.has_component_index() ? std::to_string(cd.component_index()) : "null");
os << ", indexName=" << (cd.idx_info.index_name ? *cd.idx_info.index_name : "null");
os << ", indexType=" << to_sstring(cd.idx_info.index_type);
os << "}";
return os;
}
const column_definition*
schema::get_column_definition(const bytes& name) const {
auto i = _columns_by_name.find(name);

View File

@@ -187,9 +187,7 @@ public:
bool is_compact_value() const { return kind == column_kind::compact_column; }
const sstring& name_as_text() const;
const bytes& name() const;
friend std::ostream& operator<<(std::ostream& os, const column_definition& cd) {
return os << cd.name_as_text();
}
friend std::ostream& operator<<(std::ostream& os, const column_definition& cd);
friend std::ostream& operator<<(std::ostream& os, const column_definition* cd) {
return cd != nullptr ? os << *cd : os << "(null)";
}