renamed timestamp to timestamp_type_t

This commit is contained in:
Sascha Kühl 2026-01-07 09:23:47 +01:00
parent f30c250a20
commit c6747074f5
26 changed files with 47 additions and 47 deletions

View File

@ -33,7 +33,7 @@ public:
void write_value(size_t pos, const double &x) override;
void write_value(size_t pos, const utils::date_type_t &x ) override;
void write_value(size_t pos, const utils::time_type_t &x ) override;
void write_value(size_t pos, const utils::timestamp &x ) override;
void write_value(size_t pos, const utils::timestamp_type_t &x ) override;
void write_value(size_t pos, const char *x) override;
void write_value(size_t pos, const char *x, size_t size) override;
void write_value(size_t pos, const std::string &x) override;

View File

@ -24,7 +24,7 @@ public:
void read_value(const char *, size_t, double &) override {}
void read_value(const char *, size_t, utils::date_type_t &) override {}
void read_value(const char *, size_t, utils::time_type_t &) override {}
void read_value(const char *, size_t, utils::timestamp &) override {}
void read_value(const char *, size_t, utils::timestamp_type_t &) override {}
void read_value(const char *, size_t, char *, size_t) override {}
void read_value(const char *, size_t, std::string &) override {}
void read_value(const char *, size_t, std::string &, size_t) override {}
@ -58,7 +58,7 @@ public:
void read_value(const char *id, size_t index, double &value) override;
void read_value(const char *id, size_t index, utils::date_type_t &) override;
void read_value(const char *id, size_t index, utils::time_type_t &) override;
void read_value(const char *id, size_t index, utils::timestamp &) override;
void read_value(const char *id, size_t index, utils::timestamp_type_t &) override;
void read_value(const char *id, size_t index, char *value, size_t size) override;
void read_value(const char *id, size_t index, std::string &value) override;
void read_value(const char *id, size_t index, std::string &value, size_t size) override;

View File

@ -145,7 +145,7 @@ void postgres_parameter_binder::write_value(const size_t pos, const utils::time_
bind_data_.formats[pos] = 0;
}
void postgres_parameter_binder::write_value(size_t pos, const utils::timestamp &x) {
void postgres_parameter_binder::write_value(size_t pos, const utils::timestamp_type_t &x) {
}
void postgres_parameter_binder::write_value(const size_t pos, const utils::blob_type_t &x) {

View File

@ -114,7 +114,7 @@ void postgres_result_reader::read_value(const char * /*id*/, const size_t index,
}
}
void postgres_result_reader::read_value(const char * /*id*/, size_t index, utils::timestamp &value) {
void postgres_result_reader::read_value(const char * /*id*/, size_t index, utils::timestamp_type_t &value) {
if (const auto val = column(index); strlen(val) > 0) {
}
}
@ -224,7 +224,7 @@ void postgres_result_reader::read_value(const char * /*id*/, const size_t index,
set_value<utils::date_type_t>(column(index), val);
break;
case utils::basic_type::DateTime: {
set_value<utils::timestamp>(column(index), val);
set_value<utils::timestamp_type_t>(column(index), val);
break;
}
case utils::basic_type::Null: {

View File

@ -45,7 +45,7 @@ struct LoginHistory : core::Model {
matador::object::object_ptr<CollectionCenter> collection_center;
std::string login_name;
FailReason fail_reason{FailReason::NoFailReason};
matador::utils::timestamp login_time;
matador::utils::timestamp_type_t login_time;
template<typename Operator>
void process( Operator& op ) {

View File

@ -20,7 +20,7 @@ struct User : core::Model {
std::string salt;
std::string password;
LockType lock_type{LockType::NoLock};
matador::utils::timestamp locked_at;
matador::utils::timestamp_type_t locked_at;
std::string lock_reason;
std::string role;
matador::object::object_ptr<UserDirectory> user_directory;

View File

@ -17,7 +17,7 @@ struct UserSession : core::Model {
matador::object::object_ptr<User> client;
matador::object::object_ptr<Scenario> scenario;
matador::object::object_ptr<CollectionCenter> collection_center;
matador::utils::timestamp offline_since;
matador::utils::timestamp_type_t offline_since;
template<typename Operator>
void process( Operator& op ) {

View File

@ -21,7 +21,7 @@ struct Job : core::Model {
std::string description;
JobState state;
JobMode mode;
matador::utils::timestamp created_at;
matador::utils::timestamp_type_t created_at;
matador::object::object_ptr<Payload> payload;
matador::object::object_ptr<Task> task;
core::UserInfo user_info;

View File

@ -18,8 +18,8 @@ struct Task : core::Model {
TaskState state;
matador::object::object_ptr<Payload> payload;
JobMode job_mode;
matador::utils::timestamp start_delay;
matador::utils::timestamp interval;
matador::utils::timestamp_type_t start_delay;
matador::utils::timestamp_type_t interval;
uint64_t user_session_id;
template<typename Operator>

View File

@ -40,7 +40,7 @@ public:
void write_value(size_t pos, const double& x) override;
void write_value(size_t pos, const utils::date_type_t& x) override;
void write_value(size_t pos, const utils::time_type_t& x) override;
void write_value(size_t pos, const utils::timestamp& x) override;
void write_value(size_t pos, const utils::timestamp_type_t& x) override;
void write_value(size_t pos, const char* x) override;
void write_value(size_t pos, const char* x, size_t size) override;
void write_value(size_t pos, const std::string& x) override;

View File

@ -33,7 +33,7 @@ struct basic_type_to_string_visitor
void operator()(const std::string &x) { result = writer->to_string(x); }
void operator()(const utils::date_type_t &x) { result = writer->to_string(x); }
void operator()(const utils::time_type_t &x) { result = writer->to_string(x); }
void operator()(const utils::timestamp &x) { result = writer->to_string(x); }
void operator()(const utils::timestamp_type_t &x) { result = writer->to_string(x); }
void operator()(const utils::blob_type_t &x) { result = writer->to_string(x); }
attribute_string_writer *writer{};

View File

@ -73,7 +73,7 @@ public:
void write_value(size_t pos, const double &x) override;
void write_value(size_t pos, const utils::date_type_t &x ) override;
void write_value(size_t pos, const utils::time_type_t &x ) override;
void write_value(size_t pos, const utils::timestamp &x ) override;
void write_value(size_t pos, const utils::timestamp_type_t &x ) override;
void write_value(size_t pos, const char *x) override;
void write_value(size_t pos, const char *x, size_t size) override;
void write_value(size_t pos, const std::string &x) override;

View File

@ -27,7 +27,7 @@ public:
virtual void read_value(const char *id, size_t index, double &value) = 0;
virtual void read_value(const char *id, size_t index, time_type_t &value) = 0;
virtual void read_value(const char *id, size_t index, date_type_t &value) = 0;
virtual void read_value(const char *id, size_t index, timestamp &value) = 0;
virtual void read_value(const char *id, size_t index, timestamp_type_t &value) = 0;
virtual void read_value(const char *id, size_t index, char *value, size_t size) = 0;
virtual void read_value(const char *id, size_t index, std::string &value) = 0;
virtual void read_value(const char *id, size_t index, std::string &value, size_t size) = 0;

View File

@ -27,7 +27,7 @@ public:
virtual void write_value(size_t pos, const double &x) = 0;
virtual void write_value(size_t pos, const date_type_t &x) = 0;
virtual void write_value(size_t pos, const time_type_t &x) = 0;
virtual void write_value(size_t pos, const timestamp &x) = 0;
virtual void write_value(size_t pos, const timestamp_type_t &x) = 0;
virtual void write_value(size_t pos, const char *x) = 0;
virtual void write_value(size_t pos, const char *x, size_t size) = 0;
virtual void write_value(size_t pos, const std::string &x) = 0;

View File

@ -33,7 +33,7 @@ public:
void operator()(std::string &x) { this->convert(x); }
void operator()(date_type_t &x) { this->convert(x); }
void operator()(time_type_t &x) { this->convert(x); }
void operator()(timestamp &x) { this->convert(x); }
void operator()(timestamp_type_t &x) { this->convert(x); }
void operator()(blob_type_t &x) { this->convert(x); }
private:

View File

@ -286,7 +286,7 @@ result<DestType, conversion_error> to(const char *source, std::enable_if_t<std::
template < typename DestType >
result<DestType, conversion_error> to(const std::string &source, std::enable_if_t<std::is_same_v<DestType, timestamp>>* = nullptr) {
result<DestType, conversion_error> to(const std::string &source, std::enable_if_t<std::is_same_v<DestType, timestamp_type_t>>* = nullptr) {
std::tm result{};
std::istringstream iss(source);
iss >> std::get_time(&result, "%Y-%m-%d %H:%M:%S");
@ -302,7 +302,7 @@ result<DestType, conversion_error> to(const std::string &source, std::enable_if_
}
template < typename DestType >
result<DestType, conversion_error> to(const char *source, std::enable_if_t<std::is_same_v<DestType, timestamp>>* = nullptr) {
result<DestType, conversion_error> to(const char *source, std::enable_if_t<std::is_same_v<DestType, timestamp_type_t>>* = nullptr) {
return to<DestType>(std::string{source});
}
@ -318,7 +318,7 @@ result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_
}
template < typename DestType, typename SourceType >
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_integral_v<DestType> && !std::is_same_v<bool, DestType> && std::is_same_v<timestamp, SourceType>>* = nullptr) {
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_integral_v<DestType> && !std::is_same_v<bool, DestType> && std::is_same_v<timestamp_type_t, SourceType>>* = nullptr) {
return failure(conversion_error::NotConvertable);
}
@ -333,7 +333,7 @@ result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_
}
template < typename DestType, typename SourceType >
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_same_v<bool, DestType> && std::is_same_v<timestamp, SourceType>>* = nullptr) {
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_same_v<bool, DestType> && std::is_same_v<timestamp_type_t, SourceType>>* = nullptr) {
return failure(conversion_error::NotConvertable);
}
@ -348,7 +348,7 @@ result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_
}
template < typename DestType, typename SourceType >
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_floating_point_v<DestType> && std::is_same_v<timestamp, SourceType>>* = nullptr) {
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_floating_point_v<DestType> && std::is_same_v<timestamp_type_t, SourceType>>* = nullptr) {
return failure(conversion_error::NotConvertable);
}
@ -363,7 +363,7 @@ result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_
}
template < typename DestType, typename SourceType >
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_same_v<blob_type_t, DestType> && std::is_same_v<timestamp, SourceType>>* = nullptr) {
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_same_v<blob_type_t, DestType> && std::is_same_v<timestamp_type_t, SourceType>>* = nullptr) {
return failure(conversion_error::NotConvertable);
}
@ -378,7 +378,7 @@ result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_
}
template < typename DestType, typename SourceType >
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_same_v<std::string, DestType> && std::is_same_v<timestamp, SourceType>>* = nullptr) {
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_same_v<std::string, DestType> && std::is_same_v<timestamp_type_t, SourceType>>* = nullptr) {
return failure(conversion_error::NotConvertable);
}
@ -393,7 +393,7 @@ result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_
}
template < typename DestType, typename SourceType >
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_integral_v<SourceType> && !std::is_same_v<bool, SourceType> && std::is_same_v<timestamp, DestType>>* = nullptr) {
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_integral_v<SourceType> && !std::is_same_v<bool, SourceType> && std::is_same_v<timestamp_type_t, DestType>>* = nullptr) {
return failure(conversion_error::NotConvertable);
}
@ -408,7 +408,7 @@ result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_
}
template < typename DestType, typename SourceType >
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_floating_point_v<SourceType> && std::is_same_v<timestamp, DestType>>* = nullptr) {
result<DestType, conversion_error> to(const SourceType &/*source*/, std::enable_if_t<std::is_floating_point_v<SourceType> && std::is_same_v<timestamp_type_t, DestType>>* = nullptr) {
return failure(conversion_error::NotConvertable);
}
@ -423,7 +423,7 @@ result<DestType, conversion_error> to(const blob_type_t &/*source*/, std::enable
}
template < typename DestType>
result<DestType, conversion_error> to(const blob_type_t &/*source*/, std::enable_if_t<std::is_same_v<timestamp, DestType>>* = nullptr) {
result<DestType, conversion_error> to(const blob_type_t &/*source*/, std::enable_if_t<std::is_same_v<timestamp_type_t, DestType>>* = nullptr) {
return failure(conversion_error::NotConvertable);
}
@ -438,7 +438,7 @@ result<DestType, conversion_error> to(const bool &/*source*/, std::enable_if_t<s
}
template < typename DestType>
result<DestType, conversion_error> to(const bool &/*source*/, std::enable_if_t<std::is_same_v<timestamp, DestType>>* = nullptr) {
result<DestType, conversion_error> to(const bool &/*source*/, std::enable_if_t<std::is_same_v<timestamp_type_t, DestType>>* = nullptr) {
return failure(conversion_error::NotConvertable);
}
@ -463,7 +463,7 @@ result<DestType, conversion_error> to(const date_type_t &source, std::enable_if_
}
template < typename DestType>
result<DestType, conversion_error> to(const timestamp &source, std::enable_if_t<std::is_same_v<time_type_t, DestType>>* = nullptr) {
result<DestType, conversion_error> to(const timestamp_type_t &source, std::enable_if_t<std::is_same_v<time_type_t, DestType>>* = nullptr) {
const std::time_t tt = std::chrono::system_clock::to_time_t(source);
const std::tm* result = std::localtime(&tt);
@ -472,7 +472,7 @@ result<DestType, conversion_error> to(const timestamp &source, std::enable_if_t<
}
template < typename DestType>
result<DestType, conversion_error> to(const timestamp &source, std::enable_if_t<std::is_same_v<date_type_t, DestType>>* = nullptr) {
result<DestType, conversion_error> to(const timestamp_type_t &source, std::enable_if_t<std::is_same_v<date_type_t, DestType>>* = nullptr) {
const std::time_t tt = std::chrono::system_clock::to_time_t(source);
const std::tm* result = std::localtime(&tt);

View File

@ -152,10 +152,10 @@ struct data_type_traits<time_type_t, void> {
};
template<>
struct data_type_traits<timestamp, void> {
struct data_type_traits<timestamp_type_t, void> {
static basic_type type(std::size_t /*size*/) { return basic_type::DateTime; }
static void read_value(attribute_reader &reader, const char *id, size_t index, timestamp &value);
static void bind_value(attribute_writer &binder, size_t index, timestamp &value);
static void read_value(attribute_reader &reader, const char *id, size_t index, timestamp_type_t &value);
static void bind_value(attribute_writer &binder, size_t index, timestamp_type_t &value);
};
template<typename EnumType>

View File

@ -13,7 +13,7 @@ enum class basic_type : uint8_t;
using byte = unsigned char;
using blob_type_t = std::vector<byte>;
using timestamp = std::chrono::system_clock::time_point;
using timestamp_type_t = std::chrono::system_clock::time_point;
struct date_type_t;
struct time_type_t;
@ -26,7 +26,7 @@ using database_type = std::variant<
const char*,
std::string,
blob_type_t,
timestamp,
timestamp_type_t,
date_type_t,
time_type_t,
nullptr_t>;

View File

@ -147,11 +147,11 @@ void data_type_traits<time_type_t>::bind_value(attribute_writer &binder, const s
binder.write_value(index, value);
}
void data_type_traits<timestamp>::read_value(attribute_reader &reader, const char *id, const size_t index, timestamp &value) {
void data_type_traits<timestamp_type_t>::read_value(attribute_reader &reader, const char *id, const size_t index, timestamp_type_t &value) {
reader.read_value(id, index, value);
}
void data_type_traits<timestamp>::bind_value(attribute_writer &binder, const size_t index, timestamp &value) {
void data_type_traits<timestamp_type_t>::bind_value(attribute_writer &binder, const size_t index, timestamp_type_t &value) {
binder.write_value(index, value);
}
}

View File

@ -96,7 +96,7 @@ void initialize_by_basic_type(const basic_type type, database_type &val) {
val.emplace<time_type_t>();
break;
case basic_type::DateTime:
val.emplace<timestamp>();
val.emplace<timestamp_type_t>();
break;
case basic_type::Blob:
val.emplace<blob_type_t>();

View File

@ -77,7 +77,7 @@ void attribute_string_writer::write_value(size_t /*pos*/, const utils::time_type
result_ = "'" + dialect_.prepare_literal(utils::to_string(x)) + "'";
}
void attribute_string_writer::write_value(size_t /*pos*/, const utils::timestamp &/*x*/) {
void attribute_string_writer::write_value(size_t /*pos*/, const utils::timestamp_type_t &/*x*/) {
}
void attribute_string_writer::write_value(size_t pos, const char *x) {

View File

@ -69,7 +69,7 @@ void value_extractor::write_value(size_t /*pos*/, const utils::time_type_t &x) {
values_.emplace_back(x);
}
void value_extractor::write_value(size_t /*pos*/, const utils::timestamp &x) {
void value_extractor::write_value(size_t /*pos*/, const utils::timestamp_type_t &x) {
values_.emplace_back(x);
}

View File

@ -14,7 +14,7 @@ void test_parameter_binder::write_value(size_t /*pos*/, const float &/*x*/) {}
void test_parameter_binder::write_value(size_t /*pos*/, const double &/*x*/) {}
void test_parameter_binder::write_value(size_t /*pos*/, const utils::date_type_t &/*x*/) {}
void test_parameter_binder::write_value(size_t /*pos*/, const utils::time_type_t &/*x*/) {}
void test_parameter_binder::write_value(size_t /*pos*/, const utils::timestamp &/*x*/) {}
void test_parameter_binder::write_value(size_t /*pos*/, const utils::timestamp_type_t &/*x*/) {}
void test_parameter_binder::write_value(size_t /*pos*/, const char * /*x*/) {}
void test_parameter_binder::write_value(size_t /*pos*/, const char * /*x*/, size_t /*size*/) {}
void test_parameter_binder::write_value(size_t /*pos*/, const std::string &/*x*/) {}

View File

@ -20,7 +20,7 @@ public:
void write_value(size_t pos, const double &x) override;
void write_value(size_t pos, const utils::date_type_t &x) override;
void write_value(size_t pos, const utils::time_type_t &x) override;
void write_value(size_t pos, const utils::timestamp &x) override;
void write_value(size_t pos, const utils::timestamp_type_t &x) override;
void write_value(size_t pos, const char *x) override;
void write_value(size_t pos, const char *x, size_t size) override;
void write_value(size_t pos, const std::string &x) override;

View File

@ -72,8 +72,8 @@ void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/,
value = {12, 34, 56, 123456};
}
void test_result_reader::read_value(const char *id, size_t index, utils::timestamp &value) {
value = utils::timestamp();
void test_result_reader::read_value(const char *id, size_t index, utils::timestamp_type_t &value) {
value = utils::timestamp_type_t();
}
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, char * /*value*/, const size_t /*size*/) {

View File

@ -23,7 +23,7 @@ public:
void read_value(const char *, size_t, double &) override {}
void read_value(const char *, size_t, utils::date_type_t &) override {}
void read_value(const char *, size_t, utils::time_type_t &) override {}
void read_value(const char *, size_t, utils::timestamp &) override {}
void read_value(const char *, size_t, utils::timestamp_type_t &) override {}
void read_value(const char *, size_t, char *, size_t) override {}
void read_value(const char *, size_t, std::string &) override {}
void read_value(const char *, size_t, std::string &, size_t) override {}
@ -54,7 +54,7 @@ public:
void read_value(const char *id, size_t index, double &value) override;
void read_value(const char *id, size_t index, utils::date_type_t &value) override;
void read_value(const char *id, size_t index, utils::time_type_t &value) override;
void read_value(const char *id, size_t index, utils::timestamp &value) override;
void read_value(const char *id, size_t index, utils::timestamp_type_t &value) override;
void read_value(const char *id, size_t index, char *value, size_t size) override;
void read_value(const char *id, size_t index, std::string &value) override;
void read_value(const char *id, size_t index, std::string &value, size_t size) override;