mirror of
https://github.com/getml/sqlgen.git
synced 2026-01-03 16:09:47 -06:00
32 lines
913 B
C++
32 lines
913 B
C++
#ifndef SQLGEN_DYNAMIC_SELECT_HPP_
|
|
#define SQLGEN_DYNAMIC_SELECT_HPP_
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "Column.hpp"
|
|
#include "SelectFrom.hpp"
|
|
#include "Table.hpp"
|
|
|
|
namespace sqlgen::dynamic {
|
|
|
|
SelectFrom select(const std::string& _table,
|
|
const std::vector<std::string>& _columns) {
|
|
std::vector<Column> columns;
|
|
for (const auto& name : _columns) {
|
|
columns.emplace_back(Column{.name = name});
|
|
}
|
|
return SelectFrom{.table = Table{.name = _table}, .columns = columns};
|
|
}
|
|
|
|
SelectFrom select(const std::string& _schema, const std::string& _table,
|
|
const std::vector<std::string>& _columns) {
|
|
std::vector<Column> columns;
|
|
for (const auto& name : _columns) {
|
|
columns.emplace_back(Column{.name = name});
|
|
}
|
|
return SelectFrom{.table = Table{.name = _table, .schema = _schema},
|
|
.columns = columns};
|
|
}
|
|
} // namespace sqlgen::dynamic
|