Skip to content

Commit b2d7fc6

Browse files
committed
Expose rel label for Python and Node.js API
1 parent 1ad8e9f commit b2d7fc6

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src_cpp/node_util.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#include "include/node_util.h"
22

33
#include "common/exception/exception.h"
4-
#include "common/types/value/value.h"
54
#include "common/types/value/nested.h"
65
#include "common/types/value/node.h"
76
#include "common/types/value/recursive_rel.h"
87
#include "common/types/value/rel.h"
8+
#include "common/types/value/value.h"
99

1010
Napi::Value Util::ConvertToNapiObject(const Value& value, Napi::Env env) {
1111
if (value.isNull()) {
@@ -119,6 +119,7 @@ Napi::Value Util::ConvertToNapiObject(const Value& value, Napi::Env env) {
119119
}
120120
napiObj.Set("_src", ConvertNodeIdToNapiObject(RelVal::getSrcNodeID(&value), env));
121121
napiObj.Set("_dst", ConvertNodeIdToNapiObject(RelVal::getDstNodeID(&value), env));
122+
napiObj.Set("_label", Napi::String::New(env, RelVal::getLabelName(&value)));
122123
return napiObj;
123124
}
124125
case LogicalTypeID::INTERNAL_ID: {

test/test_data_type.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ describe("REL", function () {
294294
assert.equal(rel.grading.length, 2);
295295
assert.equal(rel.grading[0], 2.1);
296296
assert.equal(rel.grading[1], 4.4);
297+
assert.equal(rel._label, "workAt");
297298
assert.approximately(rel.rating, 7.6, EPSILON);
298299
});
299300
});
@@ -327,6 +328,7 @@ describe("RECURSIVE_REL", function () {
327328
usedAddress: null,
328329
address: null,
329330
note: null,
331+
_label: "studyAt",
330332
_src: {
331333
offset: 0,
332334
table: 0,

0 commit comments

Comments
 (0)