From 31304a1d3db0f90823f4884f9c3ec5d2af3171fc Mon Sep 17 00:00:00 2001 From: Nut He <18328704+hetao92@users.noreply.github.com> Date: Wed, 18 May 2022 17:01:02 +0800 Subject: [PATCH] fix: get srcId when path has no relationship mod: code reiview --- ccore/nebula/gateway/dao/dao.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ccore/nebula/gateway/dao/dao.go b/ccore/nebula/gateway/dao/dao.go index fd0071b..2a5301d 100644 --- a/ccore/nebula/gateway/dao/dao.go +++ b/ccore/nebula/gateway/dao/dao.go @@ -161,6 +161,13 @@ func getPathInfo(valWarp *wrapper.ValueWrapper, data map[string]types.Any) (map[ _relationships = append(_relationships, _relation) } data["relationships"] = _relationships + if len(relationships) == 0 { + nodes := path.GetNodes() + if len(nodes) > 0 { + startNode := nodes[0] + data["srcID"] = getID(startNode.GetID()) + } + } return data, nil }