mirror of
https://github.com/matrix-construct/construct
synced 2025-02-17 09:10:08 +01:00
ircd:Ⓜ️ Add additional query() convenience template.
This commit is contained in:
parent
b38cf0012e
commit
91862e381f
1 changed files with 13 additions and 0 deletions
|
@ -15,6 +15,8 @@ namespace ircd::m
|
|||
{
|
||||
template<class R> R query(std::nothrow_t, const event::idx &, const string_view &key, R&& def, const std::function<R (const string_view &)> &);
|
||||
template<class F> auto query(std::nothrow_t, const event::idx &, const string_view &key, F&&);
|
||||
|
||||
template<class R, class F> R query(const event::idx &, const string_view &key, R&& def, F&&);
|
||||
template<class F> auto query(const event::idx &, const string_view &key, F&&);
|
||||
}
|
||||
|
||||
|
@ -41,6 +43,17 @@ ircd::m::query(const event::idx &event_idx,
|
|||
return ret;
|
||||
}
|
||||
|
||||
template<class R,
|
||||
class F>
|
||||
R
|
||||
ircd::m::query(const event::idx &event_idx,
|
||||
const string_view &key,
|
||||
R&& r,
|
||||
F&& f)
|
||||
{
|
||||
return query(std::nothrow, event_idx, key, std::forward<R>(r), std::forward<F>(f));
|
||||
}
|
||||
|
||||
/// See other overload documentation first. This overload implements
|
||||
/// non-throwing behavior when the event_idx/key(column) is not found by
|
||||
/// calling the closure with a default-constructed string so the closure can
|
||||
|
|
Loading…
Add table
Reference in a new issue