mirror of
https://github.com/matrix-construct/construct
synced 2024-11-28 17:52:54 +01:00
ircd::db::row: Add valid_all() to interface.
This commit is contained in:
parent
4333e510ef
commit
b8521117c1
2 changed files with 27 additions and 3 deletions
|
@ -39,7 +39,9 @@ struct ircd::db::row
|
|||
|
||||
public:
|
||||
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_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 string_view &) const; // true on all columns cached key
|
||||
|
|
28
ircd/db.cc
28
ircd/db.cc
|
@ -5351,13 +5351,13 @@ const
|
|||
}
|
||||
|
||||
bool
|
||||
ircd::db::row::valid()
|
||||
ircd::db::row::valid_all(const string_view &s)
|
||||
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)
|
||||
{
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue