mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::db: Add iov append for json::tuple.
This commit is contained in:
parent
124f7ea12a
commit
0d2430fc32
1 changed files with 18 additions and 0 deletions
|
@ -82,6 +82,7 @@ struct ircd::db::iov::append
|
|||
append(iov &, const row::delta &);
|
||||
append(iov &, const delta &);
|
||||
append(iov &, const string_view &key, const json::iov &);
|
||||
template<class... T> append(iov &, const string_view &key, const json::tuple<T...> &);
|
||||
};
|
||||
|
||||
struct ircd::db::iov::checkpoint
|
||||
|
@ -97,3 +98,20 @@ struct ircd::db::iov::opts
|
|||
size_t reserve_bytes = 0;
|
||||
size_t max_bytes = 0;
|
||||
};
|
||||
|
||||
template<class... T>
|
||||
ircd::db::iov::append::append(iov &iov,
|
||||
const string_view &key,
|
||||
const json::tuple<T...> &tuple)
|
||||
{
|
||||
for_each(tuple, [&iov, &key](const auto &col, auto&& val)
|
||||
{
|
||||
if(defined(val)) append
|
||||
{
|
||||
iov, delta
|
||||
{
|
||||
col, key, byte_view<string_view>{val}
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue