Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiment: embed SeaORM #903

Open
jondot opened this issue Oct 23, 2024 · 1 comment
Open

experiment: embed SeaORM #903

jondot opened this issue Oct 23, 2024 · 1 comment

Comments

@jondot
Copy link
Contributor

jondot commented Oct 23, 2024

Try embedding SeaORM (remove dep from end user project, all SeaORM operations and types come from the main loco namespace: loco::sea_orm).

This experiment might help to consider the pros/cons of such a move.
The goal is to remove the friction from the user by controlling SeaORM versions.

It might be worth to also do the same with axum

@jondot
Copy link
Contributor Author

jondot commented Oct 23, 2024

Findings:

  • cannot embed SeaORM because sea-orm-cli tooling rely on bare sea_orm imports, and so we have to keep it as a top level dep.

To watch on upgrades:

  • sea-orm
  • axum - debug_handler needs bare import
  • tokio - test derive needs bare import
  • include_dir - used for mailers, offer this from inside loco_rs. cannot be embedded because derive needs a bare import
  • validator - is already being used internally, and is redundant on the Cargo.toml side. cannot be embedded because derive needs a bare import

To embed+reexport:

  • tokio, provide thru loco for supported featureset
  • axum provide thru loco for supported featureset
  • tracing - used all over loco, and should be used by app. although this is harmless to also maintain in the app Cargo.toml it is one more dep to remove there so it cleans up.
  • async_trait - similar technically to tracing
  • chrono, uuid - since we already use it internally, offer it via pub use, to centralize its use, increase likelihood of using same version in a project

To modify:

  • sea-orm on Cargo.toml can be reduced to default-features=false and features=["macros"] only as the only need for the app is for the contracts.
  • sea-orm-migrations on migrations/Cargo.toml can be default-features=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant