weldsorm / welds

BSD 3-Clause "New" or "Revised" License
119 stars 6 forks source link

Compile error #10

Closed mjm918 closed 1 year ago

mjm918 commented 1 year ago

After adding the lib using cargo, i'm getting the following error:

compile_error!(
    "one of the features ['runtime-actix-native-tls', 'runtime-async-std-native-tls', \
     'runtime-tokio-native-tls', 'runtime-actix-rustls', 'runtime-async-std-rustls', \
     'runtime-tokio-rustls'] must be enabled"
);
lex148 commented 1 year ago

Sounds like you haven't selected an async runtime yet. Welds is built as a wrapper around sqlx and sqlx really wants you to specify exactly what async runtime to use.

I think you just need to add a couple more dependencies to your Cargo.toml file

something like this if you want to use async-std

async-std = { version = "1", features = ["attributes"] }
sqlx = { version = "0.6", features = [ "runtime-async-std-rustls",  "macros"] }
welds = { version = '0.1', features=["sqlite", "detect", "check"] }

or like this if you like tokio

tokio = { version = "1", features = ["rt", "macros"]}
welds = { version = '0.1', features = ["sqlite", 'detect', 'check']  }
sqlx = { version = "0.6", features = [ 'runtime-tokio-rustls',  "macros"] }

of course you will want to enable the feature for the DB type you want to use (sqlite, postgres, mysql, mssql)

mjm918 commented 1 year ago

I missed the runtime feature in sqlx. thanks for the help ☺️