javascript - 使用带有真值 if 语句的 etcd 事务
问题描述
在 JavaScript 中,我试图etcd
在 1 个事务中进行多个密钥更新。我已经过滤了我想要在事务之前更新的键值对,所以基本上我没有任何比较要做。我想像这样使用它:
const client = new Etcd3({ hosts: connectionString });
...
await client.if(true)
.then(
client.put(entry1).value(JSON.stringify(account1, null, 4));
client.put(entry2).value(JSON.stringify(account2, null, 4));
client.put(entry3).value(JSON.stringify(account3, null, 4));
client.put(entry4).value(JSON.stringify(account4, null, 4));
)
.else();
有什么我可以代替true
它以同样的方式起作用的吗?
解决方案
推荐阅读
- php - 如何在测试代码时完全覆盖条件(例如 PHP 和 xdebug)
- postgresql - EF6 + PostgreSQL + SSL
- javascript - 如何在 selenium 中使用无头 Chrome 启用 JavaScript
- python - Python如何避免在numpy where子句之后从日期到纳秒的数据类型变化
- r - 我需要使用面板数据获得固定效果的功能建议
- php - Magento 2 管理门户 ERR_TOO_MANY_REDIRECTS
- javascript - 如何在 Cesium Js 中创建一个单独的时钟并使用自定义控件对其进行控制
- python - heroku 错误:由于 EnvironmentError 无法安装软件包:
- reactjs - 防止将 -、+、-、++、+- 粘贴到输入数字中
- nginx - kong api背后的springdoc-openapi-ui