0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-26 18:38:52 +02:00

ircd:Ⓜ️ Add exists(event::id) database check.

This commit is contained in:
Jason Volk 2018-02-27 20:47:19 -08:00
parent bd4da0dd0a
commit ef9646e719
2 changed files with 19 additions and 0 deletions

View file

@ -26,6 +26,9 @@ namespace ircd::m
id::event event_id(const event &, id::event::buf &buf, const const_buffer &hash);
id::event event_id(const event &, id::event::buf &buf);
id::event event_id(const event &);
// [GET]
bool exists(const id::event &);
}
#pragma GCC diagnostic push

View file

@ -55,6 +55,22 @@ ircd::m::degree(const event::prev &prev)
return ret;
}
bool
ircd::m::exists(const id::event &event_id)
{
static constexpr auto idx
{
json::indexof<event, "event_id"_>()
};
auto &column
{
dbs::event_column.at(idx)
};
return has(column, event_id);
}
size_t
ircd::m::count(const event::prev &prev)
{