types: add time_native_type

CQL3's time_type didn't have any suitable native type,
so time_native_type is introduced to serve that purpose.
This commit is contained in:
Piotr Sarna
2018-06-14 11:11:41 +02:00
parent 9971576ecb
commit 90d323a522
2 changed files with 15 additions and 0 deletions

View File

@@ -3720,6 +3720,9 @@ data_value::data_value(simple_date_native_type v) : data_value(make_new(simple_d
data_value::data_value(timestamp_native_type v) : data_value(make_new(timestamp_type, v.tp)) {
}
data_value::data_value(time_native_type v) : data_value(make_new(time_type, v.nanoseconds)) {
}
data_value::data_value(timeuuid_native_type v) : data_value(make_new(timeuuid_type, v.uuid)) {
}

View File

@@ -328,6 +328,11 @@ struct timestamp_native_type {
primary_type tp;
};
struct time_native_type {
using primary_type = int64_t;
primary_type nanoseconds;
};
struct timeuuid_native_type {
using primary_type = utils::UUID;
primary_type uuid;
@@ -371,6 +376,7 @@ public:
data_value(seastar::net::inet_address);
data_value(simple_date_native_type);
data_value(timestamp_native_type);
data_value(time_native_type);
data_value(timeuuid_native_type);
data_value(db_clock::time_point);
data_value(boost::multiprecision::cpp_int);
@@ -1285,6 +1291,12 @@ shared_ptr<const abstract_type> data_type_for<timestamp_native_type>() {
return timestamp_type;
}
template <>
inline
shared_ptr<const abstract_type> data_type_for<time_native_type>() {
return time_type;
}
template <>
inline
shared_ptr<const abstract_type> data_type_for<timeuuid_native_type>() {