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

modules/console: Allow an all-column argument to db compact cmd.

This commit is contained in:
Jason Volk 2018-12-10 14:53:12 -08:00
parent 8d6c7e3576
commit a6bd8ec9aa

View file

@ -1467,11 +1467,6 @@ try
return true;
}
db::column column
{
database, colname
};
const bool integer
{
begin? try_lex_cast<uint64_t>(begin) : false
@ -1489,10 +1484,25 @@ try
integer && end? byte_view<string_view>(integers[1]) : end,
};
compact(column, range, level);
const auto compact_column{[&out, &database, &level, &range]
(const string_view &colname)
{
db::column column
{
database, colname
};
if(level > -2)
compact(column, level);
compact(column, range, level);
if(level > -2)
compact(column, level);
}};
if(colname != "*")
compact_column(colname);
else
for(const auto &column : database.columns)
compact_column(name(*column));
out << "done" << std::endl;
return true;