如何在 dgraph 查询中获取子字符串

How to get a substring in dgraph query

当我执行这个查询时

{
  message (func: uid(0x4e22)) {
    message
  }
}

我收到回复

{
  "data": {
    "message": [
      {
        "message": "really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message "
      }
    ]
  },
  ...
}

但我希望我的 returned 数据具有 message 的缩短预览版本,如下所示

        "message": "really long message rea"

在 dgraph 查询语言中有什么方法可以 return 这样的子字符串吗?

暂无。通过即将推出的 @lambda 指令和 javascript 钩子函数,您可以拥有这样的功能。 20.11版本预计2020年11月上旬发布