• Neo4j parameter


     Neo4j browser:

    $ :help param

    Set a parameter

    Set a parameter to be sent with queries.

    The :param name => 'Stella' command will define a parameter named "name" and it will be sent along with your queries. 
    Using parameters, rather than hard coding values, will allow for reuse of the query plan cache

    The right hand side of => is sent to the server and evaluated as Cypher with an implicit RETURN in front. This gives better type safety since some types (especially numbers) in JavaScript are hard to match with Neo4j:s type system. 
    To set a param as an integer, do :param x => 1 and to set it as a float, do :param x => 1.0.

    Cypher query example with a param:  MATCH (n:Person) WHERE n.name = $name.

    $ :help params

    Parameters

    View and set parameters to be sent with queries.

    The :params command will show you a list of all your current parameters.

    Note that setting parameters using this method does not provide type safety with numbers. 
    Instead we advise you to set each param one by one using the :param x => 1 syntax. 
    See :help param for more info.

    The :params {name: 'Stella', age: 24} command will replace your current parameters with the new parameters defined in the object.


    转载:

    作者:wry2008wry 
    来源:CSDN 
    原文:https://blog.csdn.net/wry2008wry/article/details/82984473 
    版权声明:本文为博主原创文章,转载请附上博文链接!

    neo4j browser中定义参数变量

    概念

    在neo4j browser网页中调试cypher语句时,使用预先定义的变量会更方便且增加代码的可读性,类似于SQL语句中的参数。

    参数对当前会话有效,网页刷新变量消失。变量为一个kv的键值对。

    定义的语法是

    :param a:1, b:2

    :param {a: 1, b: 2}

    如上,定义方式为一个冒号+param+空格+参数,注意有一个空格。有两种方式定义变量 :叠加的方式、整体的方式。

    叠加方式

    即将多个变量列出来,以追加的方式,如果变量的key已经存在则替换已有的,否则新建,如:

    :param a:1, b:2

    整体方式

    整体更新定义变量的键值对,以前所有的变量被覆盖:

    :param {a: 1, b: 2}

    显示所有变量

    在命令框中输入

    :params

    使用变量

    先定义一个列表类型的变量

    :param items:[1, 2,  3]

    使用变量:

    UNWIND $items as item

    return item

    注意使用变量的时候在变量名前中一个$,和phpe及shell类似
    --------------------- 

  • 相关阅读:
    为开源项目 go-gin-api 增加后台任务模块
    将多行数据以',' 进行分隔
    syslog中的“(CRON)信息(未安装MTA,丢弃输出)”错误,crontab定时任务失效
    为什么我不推荐大家去外包公司?
    Linux永久修改系统时间
    云数据库 Redis 暂时不支持外网访问
    Nginx中worker connections问题的解决方法 大量用户502
    入手
    nginx 之$proxy_host|$host|$http_host区别
    grpc-golang入门
  • 原文地址:https://www.cnblogs.com/jpfss/p/11474186.html
Copyright © 2020-2023  润新知