From aa06e58cb8f1092dda8a1b3c3e526f4b3932cd24 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Wed, 23 Aug 2023 17:27:56 +0800 Subject: [PATCH] Update 4.schema.md --- .../6.functions-and-expressions/4.schema.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md index e6dd6f69523..333d6deb57b 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md @@ -318,6 +318,32 @@ nebula> MATCH (v:player{name:"Tim Duncan"})-[e]->() \ +----------+ ``` +### typeid() + +typeid() returns the internal ID value of the Edge type of the edge, which can be used to determine the direction by positive or negative. + +Syntax: `typeid()` + +- Result type: Int + +Example: + +```ngql +nebula> MATCH (v:player)-[e:follow]-(v2) RETURN e,typeid(e), \ + CASE WHEN typeid(e) > 0 \ + THEN "Forward" ELSE "Reverse" END AS direction \ + LIMIT 5; ++----------------------------------------------------+-----------+-----------+ +| e | typeid(e) | direction | ++----------------------------------------------------+-----------+-----------+ +| [:follow "player127"->"player114" @0 {degree: 90}] | 5 | "Forward" | +| [:follow "player127"->"player148" @0 {degree: 70}] | 5 | "Forward" | +| [:follow "player148"->"player127" @0 {degree: 80}] | -5 | "Reverse" | +| [:follow "player147"->"player136" @0 {degree: 90}] | 5 | "Forward" | +| [:follow "player136"->"player147" @0 {degree: 90}] | -5 | "Reverse" | ++----------------------------------------------------+-----------+-----------+ +``` + ### src() src() returns the source vertex ID of an edge.