与 Play 集成时,此应用如何从 IOConnection/IO 转变为未来?

How is this app converting from an IOConnection/IO to a future when integrating with Play?

我正在 github 上查看这个同时使用 play 和 doobie 的存储库。

我想了解它最终如何从猫的 connectionIO/IO 转换为构建游戏框架的未来。

我正在查看一个控制器,我可以看到 userRepo,但我看不到它的去向或方式 to/from 未来到 IO。

  def doEdit(): Action[AnyContent] = UserAction { implicit req =>
    GsForms.user.bindFromRequest.fold(
      formWithErrors => editView(formWithErrors),
      data => userRepo.edit(data)
        .map(_ => Redirect(PublishedSpeakerRoutes.detail(req.user.slug)).flashing("success" -> "Profile updated"))
    )

}

https://github.com/gospeak-io/gospeak/blob/36fd9dd4ebe314c2ca8e02e2e2c714b6d399d045/web/app/gospeak/web/pages/user/profile/ProfileCtrl.scala#L28

最终调用了unsafeToFuture

Evaluates the effect and produces the result in a Future.

在第 UICtrl.scala#L59. These questions are best answered by Goto definition feature of IDE. For example, Metals provides it for all major editors 行。通常快捷方式是符号名称上的 command+clickcontrol+click