query/include/matador/sql/table.hpp

48 lines
1.1 KiB
C++

#ifndef QUERY_TABLE_HPP
#define QUERY_TABLE_HPP
#include "matador/sql/column.hpp"
#include <string>
#include <vector>
namespace matador::sql {
class column;
class table {
public:
table() = default;
table(const char *name); // NOLINT(*-explicit-constructor)
table(std::string name); // NOLINT(*-explicit-constructor)
table(const char *name, std::string as); // NOLINT(*-explicit-constructor)
table(std::string name, std::string as); // NOLINT(*-explicit-constructor)
table(std::string name, std::string as, const std::vector<column> &columns);
table& as(const std::string &a);
[[nodiscard]] bool operator==(const table &x) const;
[[nodiscard]] table as(const std::string &a) const;
[[nodiscard]] bool has_alias() const;
[[nodiscard]] const std::string& name() const;
[[nodiscard]] const std::string& alias() const;
[[nodiscard]] const std::vector<column>& columns() const;
private:
friend class column;
std::string name_;
std::string alias_;
std::string schema_name_;
std::vector<column> columns_;
};
table operator ""_tab(const char *name, size_t len);
}
#endif //QUERY_TABLE_HPP