Kùzu C++ API
Loading...
Searching...
No Matches
property.h
Go to the documentation of this file.
1#pragma once
2
3#include "copy_constructors.h"
4#include "types.h"
5#include "parsed_expression.h"
6
7namespace kuzu {
8namespace common {
9class Serializer;
10class Deserializer;
11} // namespace common
12
13namespace catalog {
14
15class Property {
16public:
17 Property() = default;
18 Property(std::string name, common::LogicalType dataType,
19 std::unique_ptr<parser::ParsedExpression> defaultExpr)
20 : Property{std::move(name), std::move(dataType), std::move(defaultExpr),
21 common::INVALID_PROPERTY_ID, common::INVALID_COLUMN_ID, common::INVALID_TABLE_ID} {}
22 Property(std::string name, common::LogicalType dataType,
23 std::unique_ptr<parser::ParsedExpression> defaultExpr, common::property_id_t propertyID,
25 : name{std::move(name)}, defaultExpr{std::move(defaultExpr)}, dataType{std::move(dataType)},
26 propertyID{propertyID}, columnID{columnID}, tableID{tableID} {}
28
29 std::string getName() const { return name; }
30
31 void setColumnID(common::column_id_t columnID) { this->columnID = columnID; }
32 const common::LogicalType& getDataType() const { return dataType; }
33 common::property_id_t getPropertyID() const { return propertyID; }
34 common::column_id_t getColumnID() const { return columnID; }
35 common::table_id_t getTableID() const { return tableID; }
36 const parser::ParsedExpression* getDefaultExpr() const { return defaultExpr.get(); }
37
38 void rename(std::string newName) { name = std::move(newName); }
39
40 void serialize(common::Serializer& serializer) const;
42
43 static std::string toCypher(const std::vector<Property>& properties);
44
45private:
46 Property(const Property& other)
47 : name{other.name}, defaultExpr{other.defaultExpr->copy()}, dataType{other.dataType.copy()},
48 propertyID{other.propertyID}, columnID{other.columnID}, tableID{other.tableID} {}
49
50private:
51 std::string name;
52 std::unique_ptr<parser::ParsedExpression> defaultExpr;
53 common::LogicalType dataType;
54 common::property_id_t propertyID;
55 common::column_id_t columnID;
56 common::table_id_t tableID;
57};
58
59} // namespace catalog
60} // namespace kuzu
Definition property.h:15
static Property deserialize(common::Deserializer &deserializer)
std::string getName() const
Definition property.h:29
const common::LogicalType & getDataType() const
Definition property.h:32
common::table_id_t getTableID() const
Definition property.h:35
common::column_id_t getColumnID() const
Definition property.h:34
Property(std::string name, common::LogicalType dataType, std::unique_ptr< parser::ParsedExpression > defaultExpr, common::property_id_t propertyID, common::column_id_t columnID, common::table_id_t tableID)
Definition property.h:22
Property(std::string name, common::LogicalType dataType, std::unique_ptr< parser::ParsedExpression > defaultExpr)
Definition property.h:18
const parser::ParsedExpression * getDefaultExpr() const
Definition property.h:36
void serialize(common::Serializer &serializer) const
void rename(std::string newName)
Definition property.h:38
static std::string toCypher(const std::vector< Property > &properties)
EXPLICIT_COPY_DEFAULT_MOVE(Property)
common::property_id_t getPropertyID() const
Definition property.h:33
void setColumnID(common::column_id_t columnID)
Definition property.h:31
Definition deserializer.h:15
Definition types.h:201
Definition serializer.h:15
Definition parsed_expression.h:29
property_id_t column_id_t
Definition types.h:36
uint32_t property_id_t
Definition types.h:34
uint64_t table_id_t
Definition internal_id_t.h:14
Definition alter_type.h:5