NyxCode / ormx

bringing orm-like features to sqlx
MIT License
287 stars 32 forks source link

example is broken #21

Closed tylerhawkes closed 5 days ago

tylerhawkes commented 2 years ago

I'm trying to use ormx and I can't even get the example to run. If I use the schema

create table users (
  id serial4 primary key,
  first_name varchar,
  last_name varchar,
  email varchar,
  last_login timestamp
);

and just a simple cargo build I get a bunch of errors.

error[E0308]: mismatched types
  --> src/schema.rs:21:10
   |
21 | #[derive(ormx::Table)]
   |          ^^^^^^^^^^^ expected `u32`, found `i32`
   |
   = note: this error originates in the macro `$crate::sqlx_macros::expand_query` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
  --> src/schema.rs:21:10
   |
21 | #[derive(ormx::Table)]
   |          ^^^^^^^^^^^ expected struct `std::string::String`, found enum `Option`
   |
   = note: expected struct `std::string::String`
                found enum `Option<std::string::String>`
   = note: this error originates in the macro `$crate::sqlx_macros::expand_query` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
  --> src/schema.rs:21:10
   |
21 | #[derive(ormx::Table)]
   |          ^^^^^^^^^^^ expected `i32`, found `u32`
   |
   = note: this error originates in the derive macro `ormx::Table` (in Nightly builds, run with -Z macro-backtrace for more info)

because these are type mismatches in the compiler, they're almost impossible to debug. I'm using the latest postgres.

NyxCode commented 2 years ago

that's weird - did you do cargo run in ./example-postgres?

NyxCode commented 2 years ago

I think it'd be great if you could show exactly what you did.