initial matador ng commit

This commit is contained in:
2025-02-02 20:37:12 +01:00
parent 19de5714f4
commit ded3daceb3
378 changed files with 14913 additions and 13431 deletions
+12 -11
View File
@@ -1,23 +1,27 @@
#ifndef QUERY_FIELD_HPP
#define QUERY_FIELD_HPP
#include "matador/sql/value.hpp"
#include "matador/utils/value.hpp"
#include "matador/utils/basic_types.hpp"
#include <optional>
#include <string>
namespace matador::sql {
class field
{
/**
*
*/
class field {
public:
explicit field(std::string name);
template<typename Type>
field(std::string name, Type value, size_t size = 0, int index = -1)
field(std::string name, Type value, const size_t size = 0, const int index = -1)
: name_(std::move(name))
, index_(index)
, value_(value, size) {}
field(std::string name, data_type_t data_type, size_t size = 0, int index = -1);
field(std::string name, utils::basic_type dt, size_t size = 0, int index = -1);
field(const field &x) = default;
field& operator=(const field &x) = default;
field(field &&x) noexcept;
@@ -35,8 +39,7 @@ public:
[[nodiscard]] int index() const;
template<class Type>
std::optional<Type> as() const
{
std::optional<Type> as() const {
return value_.as<Type>();
}
@@ -49,14 +52,12 @@ public:
[[nodiscard]] bool is_varchar() const;
[[nodiscard]] bool is_blob() const;
[[nodiscard]] bool is_null() const;
[[nodiscard]] bool is_unknown() const;
friend std::ostream& operator<<(std::ostream &out, const field &col);
private:
template<class Operator>
void process(Operator &op)
{
void process(Operator &op) {
op.on_attribute(name_.c_str(), value_, value_.size());
}
@@ -66,7 +67,7 @@ private:
std::string name_;
int index_{-1};
value value_;
utils::value value_;
};
}