Helper function to get field name from Product type structure
| 191 | |
| 192 | // Helper function to get field name from Product type structure |
| 193 | std::string V9Builder::getFieldName(const bsatn::AlgebraicType& table_type, uint16_t column_index) const { |
| 194 | if (table_type.tag() != bsatn::AlgebraicTypeTag::Product) { |
| 195 | return "column" + std::to_string(column_index); |
| 196 | } |
| 197 | |
| 198 | const auto& product = table_type.as_product(); |
| 199 | if (column_index >= product.elements.size()) { |
| 200 | return "column" + std::to_string(column_index); |
| 201 | } |
| 202 | |
| 203 | const auto& element = product.elements[column_index]; |
| 204 | if (element.name.has_value()) { |
| 205 | return element.name.value(); |
| 206 | } |
| 207 | |
| 208 | return "column" + std::to_string(column_index); |
| 209 | } |
| 210 | |
| 211 | // Helper function to generate constraints for primary key |
| 212 | std::vector<RawConstraintDefV9> V9Builder::generateConstraintsForPrimaryKey( |