【问题标题】:Phantom DSL Conditional UpdatePhantom DSL 条件更新
【发布时间】:2018-02-20 15:47:47
【问题描述】:

我有以下条件更新返回 false。但是当我签入数据库时​​,我试图更新的列实际上已经更新了。

def deliver(d: Delivery, placedDate: java.time.LocalDate, locationKey: String, vendorId: String, orderId: String, code: String, courierId: String, courierName: String) = {
  update.
    where(_.placedDate eqs placedDate).
    and(_.locationKey eqs locationKey).
    and(_.vendorId eqs vendorId).
    and(_.orderId eqs orderId).
    modify(_.status setTo "DELIVERED").
    and(_.deliveredTime setTo LocalDateTime.now()).
    onlyIf(_.status is "COLLECTED").and(_.deliveryCode is code).future().map(_.wasApplied)
}

谢谢

【问题讨论】:

    标签: phantom-dsl


    【解决方案1】:

    这是幻象驱动程序的传递值,这意味着下面的 Datastax Java 驱动程序是生成此值的驱动程序。如果你想跟进这个,你能在 GitHub 上发布一个完整的错误吗?

    同时,如果您只是尝试测试,我建议不要依赖wasApplied,而是直接读取。

    您生成一些测试数据和更新的值,执行更新,并通过回读比较 Cassandra 中的最终结果。 wasApplied 有条件批量更新的已知问题,但除此之外,我希望它能够工作。

    【讨论】:

      猜你喜欢
      • 2016-11-05
      • 2016-04-10
      • 2016-10-10
      • 2015-09-06
      • 2018-02-22
      • 1970-01-01
      • 1970-01-01
      • 2016-11-27
      • 2021-06-22
      相关资源
      最近更新 更多