mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 03:56:42 +00:00
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:
12
schema.cc
12
schema.cc
@@ -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);
|
||||
|
||||
@@ -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)";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user