You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2024/10/10 10:33:08 UTC
(incubator-hugegraph-ai) branch support-bool created (now 79ede02)
This is an automated email from the ASF dual-hosted git repository.
jin pushed a change to branch support-bool
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-ai.git
at 79ede02 feat(client): support complete data type for PropertyKey
This branch includes the following new commits:
new 79ede02 feat(client): support complete data type for PropertyKey
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(incubator-hugegraph-ai) 01/01: feat(client): support complete data type for PropertyKey
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jin pushed a commit to branch support-bool
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-ai.git
commit 79ede0200ff88d4cc2d0e212941474436473cf81
Author: imbajin <ji...@apache.org>
AuthorDate: Thu Oct 10 18:32:59 2024 +0800
feat(client): support complete data type for PropertyKey
---
.../pyhugegraph/api/schema_manage/property_key.py | 32 ++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/hugegraph-python-client/src/pyhugegraph/api/schema_manage/property_key.py b/hugegraph-python-client/src/pyhugegraph/api/schema_manage/property_key.py
index 7ee5d44..045995e 100644
--- a/hugegraph-python-client/src/pyhugegraph/api/schema_manage/property_key.py
+++ b/hugegraph-python-client/src/pyhugegraph/api/schema_manage/property_key.py
@@ -23,7 +23,23 @@ from pyhugegraph.utils.log import log
from pyhugegraph.utils.util import ResponseValidation
+# TODO: support UpdateStrategy for PropertyKey (refer java-client/rest-api)
class PropertyKey(HugeParamsBase):
+ # Data Type: [OBJECT, BOOLEAN, BYTE, INT, LONG, FLOAT, DOUBLE, TEXT, BLOB, DATE]
+ @decorator_params
+ def asObject(self) -> "PropertyKey":
+ self._parameter_holder.set("data_type", "OBJECT")
+ return self
+
+ @decorator_params
+ def asBool(self) -> "PropertyKey":
+ self._parameter_holder.set("data_type", "BOOLEAN")
+ return self
+
+ @decorator_params
+ def asByte(self) -> "PropertyKey":
+ self._parameter_holder.set("data_type", "BYTE")
+ return self
@decorator_params
def asInt(self) -> "PropertyKey":
@@ -36,8 +52,8 @@ class PropertyKey(HugeParamsBase):
return self
@decorator_params
- def asText(self) -> "PropertyKey":
- self._parameter_holder.set("data_type", "TEXT")
+ def asFloat(self) -> "PropertyKey":
+ self._parameter_holder.set("data_type", "FLOAT")
return self
@decorator_params
@@ -45,11 +61,22 @@ class PropertyKey(HugeParamsBase):
self._parameter_holder.set("data_type", "DOUBLE")
return self
+ @decorator_params
+ def asText(self) -> "PropertyKey":
+ self._parameter_holder.set("data_type", "TEXT")
+ return self
+
+ @decorator_params
+ def asBlob(self) -> "PropertyKey":
+ self._parameter_holder.set("data_type", "BLOB")
+ return self
+
@decorator_params
def asDate(self) -> "PropertyKey":
self._parameter_holder.set("data_type", "DATE")
return self
+ # Cardinality Type [SINGLE, LIST, SET]
@decorator_params
def valueSingle(self) -> "PropertyKey":
self._parameter_holder.set("cardinality", "SINGLE")
@@ -65,6 +92,7 @@ class PropertyKey(HugeParamsBase):
self._parameter_holder.set("cardinality", "SET")
return self
+ # Aggregate Type [NONE, MAX, MIN, SUM, OLD]
@decorator_params
def calcMax(self) -> "PropertyKey":
self._parameter_holder.set("aggregate_type", "MAX")