From 316a5f6420ef2ab6b4bcb75ff18317f4de834b16 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 17:24:50 +0800 Subject: [PATCH] fix: get srcId when path has no relationship (#115) mod: code reiview Co-authored-by: Nut He <18328704+hetao92@users.noreply.github.com> --- 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 }