extract DbConn from PlumeRocket #805

已关闭
igalic 请求将 2 次代码提交从 igalic/Plume:refactor/extract-dbconn 合并至 main
igalic 评论于 4 年前
所有者

in the following Pull Request, we'lle extract DbConn from PlumeRocket, as suggested in #797

  • use rocket_contrib's #[database] to implement our DbConn
  • we do not use #[database]'s connection setup, retaining our own init_pool() and ConnectionCustomization!
  • pass DbConn in as ref instead of Copying it around.
in the following Pull Request, we'lle extract `DbConn` from `PlumeRocket`, as suggested in https://git.joinplu.me/Plume/Plume/issues/797 - use rocket_contrib's `#[database]` to implement our `DbConn` - we do *not* use `#[database]`'s connection setup, retaining our own `init_pool()` and `ConnectionCustomization`! - pass `DbConn` in as `ref` instead of `Copy`ing it around.
kiwii 评审于 4 年前
@ -41,3 +12,1 @@
&self.0
}
}
#[database("plume")]
kiwii 评论于 4 年前
所有者

I think you'll have to edit plume-models/src/config.rs so that Rocket knows the URL of this "plume" database.

I think you'll have to edit `plume-models/src/config.rs` so that Rocket knows the URL of this "plume" database.
igalic 评论于 4 年前
发布者
所有者

yesno… we want to retain our ConnectionCustomization, so we're keeping our own init_pool().

yesno… we want to retain our `ConnectionCustomization`, so we're keeping our own `init_pool()`.
igalic 标记问题为已解决
igalic4 年前 强制推送 refactor/extract-dbconn,从 9c7af7dcd4,至 3d8785e97b
igalic4 年前 修改标题 add rocket_contrib as dependencyextract DbConn from PlumeRocket
igalic 评论于 4 年前
发布者
所有者
  • pass DbConn in as ref instead of Copying it around.

This will help with the async migration, as we're currently passing all of PlumeRocket around as ref, which means that it ends up sitting somewhere in a function, until it's .awaited.

This can create lead us into a big mess, which may be impossible to untangle, so this should help not running into that to begin with.

> - pass `DbConn` in as `ref` instead of `Copy`ing it around. This will help with the `async` migration, as we're currently passing all of PlumeRocket around as `ref`, which means that it ends up sitting *somewhere* in a function, until it's `.await`ed. This can create lead us into a big mess, which may be impossible to untangle, so this should help *not* running into that to begin with.
igalic4 年前 推送了 1 个提交
e19069f750
remove DbConn from PlumeRocket
this means compilation fails, and for the next while, we'll try to make
it compile again ;)
igalic 评论于 4 年前
发布者
所有者

closing in favour of #813

closing in favour of #813
igalic "于 4 年前 关闭此合并请求 "
请重新创建此合并请求。
登录 并参与到对话中。
无审核者
未选择里程碑
未指派成员
2 名参与者
通知
到期时间
到期日期无效或超出范围。请使用 'yyyy-mm-dd' 格式。

未设置到期时间。

依赖工单

没有设置依赖项。

参考:Plume/Plume#805
正在加载...
这个人很懒,什么都没留下。