mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-18 20:55:45 +00:00
Clean up Cargo.toml
This commit is contained in:
25
Cargo.toml
25
Cargo.toml
@@ -1,4 +1,3 @@
|
||||
# This is the sqlx facade crate
|
||||
[workspace]
|
||||
members = [
|
||||
".",
|
||||
@@ -19,12 +18,12 @@ authors = [
|
||||
]
|
||||
|
||||
[features]
|
||||
default = ["macros"]
|
||||
unstable = ["sqlx-core/unstable"]
|
||||
postgres = ["sqlx-core/postgres", "sqlx-macros/postgres"]
|
||||
mariadb = ["sqlx-core/mariadb", "sqlx-macros/mariadb"]
|
||||
macros = ["sqlx-macros", "proc-macro-hack"]
|
||||
uuid = ["sqlx-core/uuid", "sqlx-macros/uuid"]
|
||||
default = [ "macros" ]
|
||||
unstable = [ "sqlx-core/unstable" ]
|
||||
postgres = [ "sqlx-core/postgres", "sqlx-macros/postgres" ]
|
||||
mariadb = [ "sqlx-core/mariadb", "sqlx-macros/mariadb" ]
|
||||
macros = [ "sqlx-macros", "proc-macro-hack" ]
|
||||
uuid = [ "sqlx-core/uuid", "sqlx-macros/uuid" ]
|
||||
|
||||
[dependencies]
|
||||
sqlx-core = { version = "0.1.0-pre", path = "sqlx-core" }
|
||||
@@ -32,19 +31,19 @@ sqlx-macros = { version = "0.1.0-pre", path = "sqlx-macros", optional = true }
|
||||
proc-macro-hack = { version = "0.5", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
async-std = { version = "1.1.0", features = ["attributes"] }
|
||||
async-std = { version = "1.1.0", features = [ "attributes" ] }
|
||||
matches = "0.1.8"
|
||||
criterion = "0.3.0"
|
||||
|
||||
[[test]]
|
||||
name = "sql-macro-test"
|
||||
required-features = ["postgres", "uuid", "macros"]
|
||||
name = "macros"
|
||||
required-features = [ "postgres", "uuid", "macros" ]
|
||||
|
||||
[[test]]
|
||||
name = "postgres-types"
|
||||
required-features = ["postgres"]
|
||||
required-features = [ "postgres" ]
|
||||
|
||||
[[bench]]
|
||||
name = "postgres_protocol"
|
||||
required-features = ["postgres", "unstable"]
|
||||
name = "postgres-protocol"
|
||||
required-features = [ "postgres", "unstable" ]
|
||||
harness = false
|
||||
|
||||
16
tests/macros.rs
Normal file
16
tests/macros.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use sqlx::types::Uuid;
|
||||
|
||||
#[async_std::test]
|
||||
async fn postgres_query() -> sqlx::Result<()> {
|
||||
let mut conn =
|
||||
sqlx::Connection::<sqlx::Postgres>::open(&env::var("DATABASE_URL").unwrap()).await?;
|
||||
|
||||
let uuid: Uuid = "256ba9c8-0048-11ea-b0f0-8f04859d047e".parse().unwrap();
|
||||
let accounts = sqlx::query!("SELECT * from accounts where id != $1", None)
|
||||
.fetch_optional(&mut conn)
|
||||
.await?;
|
||||
|
||||
println!("accounts: {:?}", accounts);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#[async_std::test]
|
||||
async fn test_sqlx_macro() -> sqlx::Result<()> {
|
||||
let mut conn =
|
||||
sqlx::Connection::<sqlx::Postgres>::open("postgres://postgres@127.0.0.1/sqlx_test").await?;
|
||||
let uuid: sqlx::types::Uuid = "256ba9c8-0048-11ea-b0f0-8f04859d047e".parse().unwrap();
|
||||
let accounts = sqlx::query!("SELECT * from accounts where id != $1", None)
|
||||
.fetch_optional(&mut conn)
|
||||
.await?;
|
||||
|
||||
println!("accounts: {:?}", accounts);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user