added connection impl class
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#ifndef QUERY_RECORD_HPP
|
||||
#define QUERY_RECORD_HPP
|
||||
|
||||
#include "matador/sql/column.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace matador::sql {
|
||||
|
||||
class record
|
||||
{
|
||||
private:
|
||||
using column_by_index = std::vector<column>;
|
||||
using column_index_pair = std::pair<std::reference_wrapper<column>, size_t>;
|
||||
using column_by_name_map = std::unordered_map<std::string, column_index_pair>;
|
||||
|
||||
public:
|
||||
using iterator = column_by_index::iterator;
|
||||
using const_iterator = column_by_index::const_iterator;
|
||||
|
||||
record() = default;
|
||||
record(std::initializer_list<column> columns);
|
||||
~record() = default;
|
||||
|
||||
template < typename Type >
|
||||
void append(const std::string &name, long size = -1)
|
||||
{
|
||||
append(make_column<Type>(name, size));
|
||||
}
|
||||
|
||||
void append(column col);
|
||||
|
||||
[[nodiscard]] const column& at(const std::string &name) const;
|
||||
const column& at(size_t index);
|
||||
|
||||
iterator find(const std::string &column_name);
|
||||
const_iterator find(const std::string &column_name) const;
|
||||
|
||||
iterator begin();
|
||||
[[nodiscard]] const_iterator begin() const;
|
||||
[[nodiscard]] const_iterator cbegin() const;
|
||||
|
||||
iterator end();
|
||||
[[nodiscard]] const_iterator end() const;
|
||||
[[nodiscard]] const_iterator cend() const;
|
||||
|
||||
[[nodiscard]] size_t size() const;
|
||||
|
||||
private:
|
||||
column_by_index columns_;
|
||||
column_by_name_map columns_by_name_;
|
||||
};
|
||||
|
||||
}
|
||||
#endif //QUERY_RECORD_HPP
|
||||
Reference in New Issue
Block a user