IronQuery
A SQL-first query builder for C++
Loading...
Searching...
No Matches
virtual_table.hpp
1#pragma once
2
3#include <iron_query/expr.hpp>
4#include <string>
5#include <string_view>
6
7namespace iron_query {
8
9class Table;
10
14class [[nodiscard]] VirtualTable {
15public:
18 virtual std::string ToString() const = 0;
19
24 virtual std::string ToStringFormatted() const;
25
29 virtual std::string ToStringBracketed() const;
30
36 virtual std::string ToStringAsFromItem() const;
37
41 Table As(std::string_view name) const;
42
48 operator Expr() const &&;
49};
50
51} // namespace iron_query
Arbitrary SQL expression.
Definition expr.hpp:46
Table with name.
Definition table.hpp:10
Any table value, including physical table, table result, materialized view, etc.
Definition virtual_table.hpp:14
virtual std::string ToString() const =0
Renders this table value as single-line SQL text. See also ToStringFormatted for a multi-line,...
virtual std::string ToStringFormatted() const
Renders this table value as multi-line, indented SQL text for readability (e.g. logging/debugging a g...
Table As(std::string_view name) const
Aliases this table value as this AS name, usable as a FROM source. name must be a valid (optionally d...
virtual std::string ToStringBracketed() const
Renders this table value as SQL text, parenthesized so it can be safely embedded as a subquery....
virtual std::string ToStringAsFromItem() const
Renders this table value as a FROM item. Distinct from ToStringBracketed because PostgreSQL's table_r...