mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 00:14:07 +01:00
modules/console: Add an event rewrite cmd.
This commit is contained in:
parent
118ed69ed3
commit
74074bfc78
1 changed files with 34 additions and 0 deletions
|
@ -6511,6 +6511,40 @@ console_cmd__event__erase(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__event__rewrite(opt &out, const string_view &line)
|
||||
{
|
||||
const params param{line, " ",
|
||||
{
|
||||
"event_id"
|
||||
}};
|
||||
|
||||
const m::event::id &event_id
|
||||
{
|
||||
param.at("event_id")
|
||||
};
|
||||
|
||||
const m::event::fetch event
|
||||
{
|
||||
event_id
|
||||
};
|
||||
|
||||
m::dbs::write_opts opts;
|
||||
opts.op = db::op::SET;
|
||||
opts.event_idx = event.event_idx;
|
||||
|
||||
db::txn txn{*m::dbs::events};
|
||||
m::dbs::write(txn, event, opts);
|
||||
|
||||
out << "executing cells:" << txn.size()
|
||||
<< " "
|
||||
<< "size: " << pretty(iec(txn.bytes()))
|
||||
<< " for " << event_id << std::endl;
|
||||
|
||||
txn();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__event__fetch(opt &out, const string_view &line)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue