added name methods to column class
This commit is contained in:
parent
56f307fd37
commit
44c50cf2af
|
|
@ -18,8 +18,7 @@ enum class sql_function_t {
|
|||
MAX
|
||||
};
|
||||
|
||||
struct column
|
||||
{
|
||||
struct column {
|
||||
column(const char *name, const std::string& as = ""); // NOLINT(*-explicit-constructor)
|
||||
explicit column(std::string name, std::string as = ""); // NOLINT(*-explicit-constructor)
|
||||
column(sql_function_t func, std::string name); // NOLINT(*-explicit-constructor)
|
||||
|
|
@ -30,6 +29,8 @@ struct column
|
|||
|
||||
column& as(std::string a);
|
||||
|
||||
[[nodiscard]] const std::string& column_name() const;
|
||||
[[nodiscard]] std::string full_name() const;
|
||||
[[nodiscard]] bool is_function() const;
|
||||
[[nodiscard]] bool has_alias() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,17 @@ column &column::as(std::string a)
|
|||
return *this;
|
||||
}
|
||||
|
||||
const std::string& column::column_name() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
std::string column::full_name() const {
|
||||
if (table_ && !table_->name.empty()) {
|
||||
return table_->name + "." + name;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
bool column::is_function() const
|
||||
{
|
||||
return function_ != sql_function_t::NONE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue