0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd::db::row: Add valid_all() to interface.

This commit is contained in:
Jason Volk 2020-06-07 03:26:31 -07:00
parent 4333e510ef
commit b8521117c1
2 changed files with 27 additions and 3 deletions

View file

@ -39,7 +39,9 @@ struct ircd::db::row
public: public:
bool valid() const; // true on any cell valid; false on empty bool valid() const; // true on any cell valid; false on empty
bool valid_all() const; // true on all cell valid; false_ on empty
bool valid(const string_view &) const; // true on any cell valid equal; false on empty bool valid(const string_view &) const; // true on any cell valid equal; false on empty
bool valid_all(const string_view &) const; // true on all cell valid equal; false on empty
bool cached() const; // true on all cell cached bool cached() const; // true on all cell cached
bool cached(const string_view &) const; // true on all columns cached key bool cached(const string_view &) const; // true on all columns cached key

View file

@ -5351,13 +5351,13 @@ const
} }
bool bool
ircd::db::row::valid() ircd::db::row::valid_all(const string_view &s)
const const
{ {
return std::any_of(std::begin(*this), std::end(*this), [] return !empty() && std::all_of(std::begin(*this), std::end(*this), [&s]
(const auto &cell) (const auto &cell)
{ {
return cell.valid(); return cell.valid(s);
}); });
} }
@ -5372,6 +5372,28 @@ const
}); });
} }
bool
ircd::db::row::valid_all()
const
{
return !empty() && std::all_of(std::begin(*this), std::end(*this), []
(const auto &cell)
{
return cell.valid();
});
}
bool
ircd::db::row::valid()
const
{
return std::any_of(std::begin(*this), std::end(*this), []
(const auto &cell)
{
return cell.valid();
});
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
// db/cell.h // db/cell.h