0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd::db: Consider if column dropped for boolean test.

This commit is contained in:
Jason Volk 2019-01-23 16:00:22 -08:00
parent 92154be55d
commit c2521b587b
3 changed files with 27 additions and 2 deletions

View file

@ -116,8 +116,8 @@ struct ircd::db::column
explicit operator database &(); explicit operator database &();
explicit operator database::column &(); explicit operator database::column &();
explicit operator bool() const { return bool(c); } explicit operator bool() const;
bool operator!() const { return !c; } bool operator!() const;
// [GET] Iterations // [GET] Iterations
const_iterator begin(gopts = {}); const_iterator begin(gopts = {});
@ -294,6 +294,13 @@ const
return *c; return *c;
} }
inline bool
ircd::db::column::operator!()
const
{
return !bool(*this);
}
inline ircd::db::column::operator inline ircd::db::column::operator
database::column &() database::column &()
{ {

View file

@ -24,6 +24,7 @@ namespace ircd::db
const std::string &name(const database::column &); const std::string &name(const database::column &);
uint32_t id(const database::column &); uint32_t id(const database::column &);
bool dropped(const database::column &);
void drop(database::column &); // Request to erase column from db void drop(database::column &); // Request to erase column from db
} }

View file

@ -1599,6 +1599,14 @@ ircd::db::drop(database::column &c)
}; };
} }
bool
ircd::db::dropped(const database::column &c)
{
return c.descriptor?
c.descriptor->drop:
true;
}
uint32_t uint32_t
ircd::db::id(const database::column &c) ircd::db::id(const database::column &c)
{ {
@ -5624,6 +5632,15 @@ const
return { *this, key }; return { *this, key };
} }
ircd::db::column::operator
bool()
const
{
return c?
!dropped(*c):
false;
}
ircd::db::column::operator ircd::db::column::operator
const descriptor &() const descriptor &()
const const