mirror of
https://github.com/matrix-construct/construct
synced 2024-11-19 00:10:59 +01:00
ircd::db: Use extern const comparators and expose them in headers.
This commit is contained in:
parent
69eab27209
commit
56074325a1
2 changed files with 9 additions and 10 deletions
|
@ -26,6 +26,9 @@
|
||||||
namespace ircd::db
|
namespace ircd::db
|
||||||
{
|
{
|
||||||
struct comparator;
|
struct comparator;
|
||||||
|
|
||||||
|
struct cmp_string_view extern const cmp_string_view;
|
||||||
|
struct cmp_int64_t extern const cmp_int64_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ircd::db::comparator
|
struct ircd::db::comparator
|
||||||
|
|
16
ircd/db.cc
16
ircd/db.cc
|
@ -751,12 +751,6 @@ const
|
||||||
const string_view limit{_limit.data(), _limit.size()};
|
const string_view limit{_limit.data(), _limit.size()};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ircd::db
|
|
||||||
{
|
|
||||||
struct cmp_string_view;
|
|
||||||
struct cmp_int64_t;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ircd::db::cmp_string_view
|
struct ircd::db::cmp_string_view
|
||||||
:db::comparator
|
:db::comparator
|
||||||
{
|
{
|
||||||
|
@ -773,7 +767,8 @@ struct ircd::db::cmp_string_view
|
||||||
return a == b;
|
return a == b;
|
||||||
}
|
}
|
||||||
}{}
|
}{}
|
||||||
};
|
}
|
||||||
|
const ircd::db::cmp_string_view;
|
||||||
|
|
||||||
struct ircd::db::cmp_int64_t
|
struct ircd::db::cmp_int64_t
|
||||||
:db::comparator
|
:db::comparator
|
||||||
|
@ -799,7 +794,8 @@ struct ircd::db::cmp_int64_t
|
||||||
return a == b;
|
return a == b;
|
||||||
}
|
}
|
||||||
}{}
|
}{}
|
||||||
};
|
}
|
||||||
|
const ircd::db::cmp_int64_t;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -923,9 +919,9 @@ ircd::db::database::column::column(database *const &d,
|
||||||
if(!this->descriptor.cmp.less)
|
if(!this->descriptor.cmp.less)
|
||||||
{
|
{
|
||||||
if(key_type == typeid(string_view))
|
if(key_type == typeid(string_view))
|
||||||
this->cmp.user = cmp_string_view{};
|
this->cmp.user = cmp_string_view;
|
||||||
else if(key_type == typeid(int64_t))
|
else if(key_type == typeid(int64_t))
|
||||||
this->cmp.user = cmp_int64_t{};
|
this->cmp.user = cmp_int64_t;
|
||||||
else
|
else
|
||||||
throw error("column '%s' key type[%s] requires user supplied comparator",
|
throw error("column '%s' key type[%s] requires user supplied comparator",
|
||||||
this->name,
|
this->name,
|
||||||
|
|
Loading…
Reference in a new issue