IronQuery
A SQL-first query builder for C++
Loading...
Searching...
No Matches
select_item.hpp
1#pragma once
2
3#include <iron_query/expr.hpp>
4#include <string>
5#include <type_traits>
6#include <utility>
7
8namespace iron_query {
9
15class [[nodiscard]] SelectItem final {
16public:
19 template <typename T,
20 std::enable_if_t<std::is_convertible_v<T, Expr>, int> = 0>
21 SelectItem(T &&value) : SelectItem(Expr(std::forward<T>(value)).ToString()) {}
22
24 std::string ToString() const;
25
26private:
27 friend class Expr;
28
29 explicit SelectItem(std::string s);
30
31 std::string s_;
32};
33
34} // namespace iron_query
Arbitrary SQL expression.
Definition expr.hpp:46
A single entry of a SELECT list: an expression, optionally renamed with Expr::As. Kept distinct from ...
Definition select_item.hpp:15
SelectItem(T &&value)
Implicitly wraps anything an Expr can be built from, e.g. an Expr, a Column, or an rvalue Condition.
Definition select_item.hpp:21
std::string ToString() const
Renders the entry as SQL text.