2
私はPhantom 1.26.6を使用しています。phantom-dslの行内の複数のフィールドを更新するにはどうすればよいですか?
// id is the primary key
case class Motorcycle(id:String, model:String, made:String, capacity:Int)
既にカサンドラに存在オートバイのインスタンスを与え、私は 、製、モデルの値を更新する能力を望みます。
// The following does not compile.
update.where(_.id.eqs(bike.id)).modify(_.model.setTo(bike.model))
.modify(_.make.setTo(bike.make))
.modify(_.capacity.setTo(bike.capacity))
// The following works.
val updateQuery = update.where(_.id.eqs(bike.id))
for {
_ <- updateQuery.modify(_.model.setTo(bike.model)).future()
_ <- updateQuery.modify(_.make.setTo(bike.made)).future()
result <- updateQuery.modify(_.capacity.setTo(bike.capacity)).future()
} yield (result)
複数のフィールドを更新する方がいいかと思います。どのような援助のため、事前に
ありがとう!