kurtbuilds / ormlite

An ORM in Rust for developers that love SQL.
https://crates.io/crates/ormlite
MIT License
234 stars 13 forks source link

Tweaks and update #30

Closed franklx closed 1 year ago

franklx commented 1 year ago

This PR contains 4 changes: 1.impl Serialize for Join to flatten the Join struct in Json serialization via serde;

  1. Add constraints to IdType (so we can use _id() as HashMap key);
  2. Changes required for upgrading from syn@1 to syn@2;
  3. Update all dependencies to latest version (including sqlx 0.7); I can split this PR if you prefer to not to merge all. You can ever reject the PR completely :)
kurtbuilds commented 1 year ago

Thank you! I'll look over this, but on first skim, it looks good. I appreciate the updates to syn and sqlx - been meaning to get around to those!

franklx commented 1 year ago

Very good. For the cli to work the same sqlx@0.7 update is needed for sqlmo (I didn't open a PR for this). I evaluated any other rust ORM and ORM-like library out there and I found the ormlite "hybrid" approach to be the best one. I'm even working on other implementations for ormlite:

  1. A one-to-many implementation based on macros and indexmap that's quite simple but is working very well;
  2. A (WIP) struct Model generator (a very simple sea generate) for postgresql (for now);

if you are interested in any of those I can share the code.

kurtbuilds commented 1 year ago

Great!

I haven't seen sea generate, but curious to see what that looks like when it's ready to share.

Definitely welcome a one-to-many PR too. Though that definitely should be it's own PR

kurtbuilds commented 1 year ago

I released 0.15 of sqlmo using sqlx 0.7.

kurtbuilds commented 1 year ago

Ok, gave this a more thorough review, looks great. I'll merge shortly.

I'll revert the path = configuration for sqlmo.

FYI, you can put overrides for those values in .cargo/config.toml file, which can be .gitignore-ed.

$ pwd
/Users/kurt/work/ormlite
$ cat .cargo/config.toml
[patch.crates-io]
sqlmo = { path = "../sqlmo" }
franklx commented 1 year ago

I didn't know about .cargo/config.toml, thank you very much!