|| apoc.meta.cypher.type - APOC 核心文档 - Neo4j 文档

apoc.meta.cypher.type

详情

语法

apoc.meta.cypher.type(value)

描述

返回给定值的类型名称。

参数

名称

类型

描述

value

ANY

要获取其类型的对象。

返回

STRING

使用 Cypher 检查类型

Cypher 可以在不使用 APOC 的情况下检查类型。

检查类型的 Cypher 语法
RETURN valueType(1.0);

更多信息请参见 Cypher 手册 → 值类型函数

使用示例

以下示例演示了如何使用 Cypher 和 APOC 测试类型

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type(1) AS output;
valueType
RETURN valueType(1) AS output;
apoc.meta.cypher.type 的结果
output

"INTEGER"

valueType 的结果
output

"INTEGER NOT NULL"

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type("Michael") AS output;
valueType
RETURN valueType("Michael") AS output;
apoc.meta.cypher.type 的结果
output

"STRING"

valueType 的结果
output

"STRING NOT NULL"

apoc.meta.cypher.type 的结果
RETURN apoc.meta.cypher.type(true) AS output;
valueType 的结果
RETURN valueType(true) AS output;
结果
output

"BOOLEAN"

结果
output

"BOOLEAN NOT NULL"

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type(datetime()) AS output;
valueType
RETURN valueType(datetime()) AS output;
apoc.meta.cypher.type 的结果
output

"DATE_TIME"

valueType 的结果
output

"ZONED DATETIME NOT NULL"

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type(["Neo4j", 2020]) AS output;
valueType
RETURN valueType(["Neo4j", 2020]) AS output;
apoc.meta.cypher.type 的结果
output

"LIST OF ANY"

valueType 的结果
output

"LIST<STRING NOT NULL | INTEGER NOT NULL> NOT NULL"

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type(["Neo4j", "Bloom"]) AS output;
valueType
RETURN valueType(["Neo4j", "Bloom"]) AS output;
apoc.meta.cypher.type 的结果
output

"LIST OF STRING"

valueType 的结果
output

"LIST<STRING NOT NULL> NOT NULL"

apoc.meta.cypher.type
CREATE (node1:Person)-[rel:FRIENDS]->(node2:Person)
RETURN apoc.meta.cypher.type(node1) AS node1Type,
       apoc.meta.cypher.type(rel) AS relType,
       apoc.meta.cypher.type(node2) AS node2Type;
valueType
CREATE (node1:Person)-[rel:FRIENDS]->(node2:Person)
RETURN valueType(node1) AS node1Type,
       valueType(rel) AS relType,
       valueType(node2) AS node2Type;
apoc.meta.cypher.type 的结果
node1Type relType node2Type

"NODE"

"RELATIONSHIP"

"NODE"

valueType 的结果
node1Type relType node2Type

"NODE NOT NULL"

"RELATIONSHIP NOT NULL"

"NODE NOT NULL"

© . This site is unofficial and not affiliated with Neo4j, Inc.