apoc.meta.cypher.isType函数在 Cypher 25 中已弃用
|
此函数已弃用。请改用 Cypher 的类型谓词表达式。 |
语法 |
|
||
描述 |
如果给定的值与指定的类型匹配,则返回 true。 |
||
参数 |
名称 |
类型 |
描述 |
|
|
要检查类型的对象。 |
|
|
|
验证类型。 |
|
返回 |
|
||
| 在 APOC 2025.07 版本发布之前,此函数在本地(on-premise)实例上受到限制。若要在旧版本上使用它,必须解除限制。详情请参阅 安装 → 加载并解除限制。 |
使用 Cypher 检查类型
无需使用 APOC,Cypher 即可检查类型。
用于检查类型的 Cypher 语法
RETURN 1.0 IS :: INTEGER;
有关更多信息,请参阅《Cypher 手册 → 类型谓词表达式》。
使用示例
以下示例演示了如何使用 Cypher 和 APOC 来测试类型
apoc.meta.cypher.isType
RETURN apoc.meta.cypher.isType(1, "NODE") AS output;
类型谓词表达式
RETURN 1 IS :: NODE AS output;
| 输出 |
|---|
false |
apoc.meta.cypher.isType
RETURN apoc.meta.cypher.isType(datetime(), "DATE_TIME") AS output;
类型谓词表达式
RETURN datetime() IS :: ZONED DATETIME AS output;
| 输出 |
|---|
true |