StormByte C++ Library: Database module 0.0.9999
StormByte-Database is a StormByte library module for handling database connections
Loading...
Searching...
No Matches
row.hxx
1#pragma once
2
3#include <StormByte/database/named_value.hxx>
4#include <StormByte/iterable.hxx>
5
6#include <vector>
7
12namespace StormByte::Database {
17 class STORMBYTE_DATABASE_PUBLIC Row: public Iterable<std::vector<NamedValue>> {
18 public:
22 Row() noexcept = default;
23
28 Row(const Row& other) = default;
29
34 Row(Row&& other) noexcept = default;
35
39 ~Row() noexcept override = default;
40
46 Row& operator=(const Row& other) = default;
47
53 Row& operator=(Row&& other) noexcept = default;
54
61 const Value& operator[](const std::string& columnName) const &;
62
69 Value& operator[](const std::string& columnName) &;
70
77 Value operator[](const std::string& columnName) &&;
78
79 // Inherit operator[] from Iterable
80 using Iterable::operator[];
81
87 inline void add(std::string&& columnName, Value&& value) {
88 m_data.emplace_back(std::move(columnName), std::move(value));
89 }
90
95 inline std::size_t Count() const noexcept {
96 return size();
97 }
98 };
99}
Row class for databases.
Definition row.hxx:17
std::size_t Count() const noexcept
Gets number of columns in the Row.
Definition row.hxx:95
Row() noexcept=default
Default Constructor.
Value class for databases.
Definition value.hxx:20