0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

modules/console: Improve output of db__txn cmd.

This commit is contained in:
Jason Volk 2018-09-26 15:32:22 -07:00
parent 45c215eb8d
commit 24b7aa56db

View file

@ -2364,10 +2364,29 @@ try
for_each(txn, [&out, &seqnum]
(const db::delta &delta)
{
const string_view &dkey
{
std::get<delta.KEY>(delta)
};
// !!! Assumption based on the events database schema. If the
// key is 8 bytes we assume it's an event::idx in binary. No
// other columns have 8 byte keys; instead they have plaintext
// event_id amalgams with some binary characters which are simply
// not displayed by the ostream. We could have a switch here to
// use m::dbs's key parsers based on the column name but that is
// not done here yet.
const string_view &key
{
dkey.size() == 8?
lex_cast(uint64_t(byte_view<uint64_t>(dkey))):
dkey
};
out << std::setw(12) << std::right << seqnum << " : "
<< std::setw(8) << std::left << reflect(std::get<delta.OP>(delta)) << " "
<< std::setw(18) << std::right << std::get<delta.COL>(delta) << " "
<< std::get<delta.KEY>(delta)
<< key
<< std::endl;
});
}});