php - 在 Google Cloud DataStore 和 PHP 中获取新实体的密钥
问题描述
在 DataStore 的文档中提到了这个例子:
$task = $datastore->entity('Task', [
'category' => 'Personal',
'done' => false,
'priority' => 4,
'description' => 'Learn Cloud Datastore'
]);
$datastore->insert($task);
我想获取刚刚插入的这个新实体的密钥。
解决方案
您可以使用类似于以下的语句:{const taskKey = datastore.key('Task');}
更多细节可以在检索实体子章节中找到。
推荐阅读
- javascript - 将数据从 .json 文件导入到 Brain.js 神经网络
- javascript - 实现复杂的 TreeList 结构
- angular - 动态改变提供者的价值
- mysql - 如何从 django 的前端在表中添加一列
- java - 如何使用 JPA 中的规范连接多个列?
- scala - 如何使用 Apache Spark 和 Scala 创建嵌套 json
- android - 在 gradle 中添加 appcompat-v7 不会自动将我的布局视图切换到 AppCompat 版本
- events - 如何在 servicenow 的日历中查看事件“我的日程安排”
- c++ - 访问旧堆栈帧
- c# - 如何在 Visual Basic 中从 C# 转换对象