iceberg-cpp
Loading...
Searching...
No Matches
sql_catalog_tables_internal.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
32
33#include <optional>
34
35#include <sqlpp23/core/basic/table.h>
36#include <sqlpp23/core/basic/table_columns.h>
37#include <sqlpp23/core/name/create_name_tag.h>
38#include <sqlpp23/core/type_traits.h>
39
40namespace iceberg::sql {
41
42// sqlpp23 name tags require a static `const char name[]` member; the
43// `SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP` macro provides that required shape.
44// NOLINTBEGIN(modernize-avoid-c-arrays)
45
47 struct CatalogName {
48 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(catalog_name, catalogName);
49 using data_type = ::sqlpp::text;
50 using has_default = std::false_type;
51 };
53 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(table_namespace, tableNamespace);
54 using data_type = ::sqlpp::text;
55 using has_default = std::false_type;
56 };
57 struct TableName {
58 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(table_name, tableName);
59 using data_type = ::sqlpp::text;
60 using has_default = std::false_type;
61 };
63 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(metadata_location, metadataLocation);
64 using data_type = std::optional<::sqlpp::text>;
65 using has_default = std::true_type;
66 };
68 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(previous_metadata_location,
69 previousMetadataLocation);
70 using data_type = std::optional<::sqlpp::text>;
71 using has_default = std::true_type;
72 };
73 struct RecordType {
74 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(iceberg_type, recordType);
75 using data_type = std::optional<::sqlpp::text>;
76 using has_default = std::true_type;
77 };
78
79 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(iceberg_tables, icebergTables);
80
81 template <typename T>
82 using _table_columns = sqlpp::table_columns<T, //
83 CatalogName, //
85 TableName, //
89 using _required_insert_columns = sqlpp::detail::type_set<
90 sqlpp::column_t<sqlpp::table_t<IcebergTables_>, CatalogName>,
91 sqlpp::column_t<sqlpp::table_t<IcebergTables_>, TableNamespace>,
92 sqlpp::column_t<sqlpp::table_t<IcebergTables_>, TableName>>;
93};
94using IcebergTables = ::sqlpp::table_t<IcebergTables_>;
95
97 struct CatalogName {
98 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(catalog_name, catalogName);
99 using data_type = ::sqlpp::text;
100 using has_default = std::false_type;
101 };
102 struct Namespace {
103 // SQL column name is `namespace`; the C++ member cannot be a keyword.
104 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(namespace, ns);
105 using data_type = ::sqlpp::text;
106 using has_default = std::false_type;
107 };
108 struct PropertyKey {
109 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(property_key, propertyKey);
110 using data_type = ::sqlpp::text;
111 using has_default = std::false_type;
112 };
114 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(property_value, propertyValue);
115 using data_type = std::optional<::sqlpp::text>;
116 using has_default = std::true_type;
117 };
118
119 SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(iceberg_namespace_properties,
120 icebergNamespaceProperties);
121
122 template <typename T>
123 using _table_columns = sqlpp::table_columns<T, //
124 CatalogName, //
125 Namespace, //
126 PropertyKey, //
128 using _required_insert_columns = sqlpp::detail::type_set<
129 sqlpp::column_t<sqlpp::table_t<IcebergNamespaceProperties_>, CatalogName>,
130 sqlpp::column_t<sqlpp::table_t<IcebergNamespaceProperties_>, Namespace>,
131 sqlpp::column_t<sqlpp::table_t<IcebergNamespaceProperties_>, PropertyKey>>;
132};
133using IcebergNamespaceProperties = ::sqlpp::table_t<IcebergNamespaceProperties_>;
134
135// NOLINTEND(modernize-avoid-c-arrays)
136
137} // namespace iceberg::sql
Definition sql_catalog_tables_internal.h:97
Definition sql_catalog_tables_internal.h:102
Definition sql_catalog_tables_internal.h:108
Definition sql_catalog_tables_internal.h:113
Definition sql_catalog_tables_internal.h:96
Definition sql_catalog_tables_internal.h:47
Definition sql_catalog_tables_internal.h:62
Definition sql_catalog_tables_internal.h:67
Definition sql_catalog_tables_internal.h:73
Definition sql_catalog_tables_internal.h:57
Definition sql_catalog_tables_internal.h:52
Definition sql_catalog_tables_internal.h:46