Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Apr 29, 2024
1 parent efa6877 commit a1148a8
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 51 deletions.
9 changes: 3 additions & 6 deletions examples/mysql/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@ async fn main() {
let database = Database::connect(&*DATABASE_URL)
.await
.expect("Fail to initialize database connection");
let schema = seaography_mysql_example::query_root::schema(
database,
*DEPTH_LIMIT,
*COMPLEXITY_LIMIT,
)
.unwrap();
let schema =
seaography_mysql_example::query_root::schema(database, *DEPTH_LIMIT, *COMPLEXITY_LIMIT)
.unwrap();
let app = Route::new().at(
&*ENDPOINT,
get(graphql_playground).post(GraphQL::new(schema)),
Expand Down
16 changes: 7 additions & 9 deletions examples/mysql/tests/mutation_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ use async_graphql::{dynamic::*, Response};
use sea_orm::Database;

async fn main() {
test_simple_insert_one().await;
test_complex_insert_one().await;
test_create_batch_mutation().await;
test_update_mutation().await;
test_delete_mutation().await;
test_simple_insert_one().await;
test_complex_insert_one().await;
test_create_batch_mutation().await;
test_update_mutation().await;
test_delete_mutation().await;
}

pub async fn get_schema() -> Schema {
let database = Database::connect("mysql://sea:[email protected]/sakila")
.await
.unwrap();
let schema =
seaography_mysql_example::query_root::schema(database, None, None)
.unwrap();
let schema = seaography_mysql_example::query_root::schema(database, None, None).unwrap();

schema
}
Expand Down Expand Up @@ -587,7 +585,7 @@ async fn test_delete_mutation() {
"#,
)
.await,
r#"
r#"
{
"filmTextDelete": 2
}
Expand Down
3 changes: 1 addition & 2 deletions examples/mysql/tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ pub async fn get_schema() -> Schema {
let database = Database::connect("mysql://sea:[email protected]/sakila")
.await
.unwrap();
let schema =
seaography_mysql_example::query_root::schema(database, None, None).unwrap();
let schema = seaography_mysql_example::query_root::schema(database, None, None).unwrap();

schema
}
Expand Down
1 change: 0 additions & 1 deletion examples/postgres/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub mod entities;
pub mod query_root;

9 changes: 3 additions & 6 deletions examples/postgres/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@ async fn main() {
let database = Database::connect(&*DATABASE_URL)
.await
.expect("Fail to initialize database connection");
let schema = seaography_postgres_example::query_root::schema(
database,
*DEPTH_LIMIT,
*COMPLEXITY_LIMIT,
)
.unwrap();
let schema =
seaography_postgres_example::query_root::schema(database, *DEPTH_LIMIT, *COMPLEXITY_LIMIT)
.unwrap();
let app = Route::new().at(
&*ENDPOINT,
get(graphql_playground).post(GraphQL::new(schema)),
Expand Down
18 changes: 8 additions & 10 deletions examples/postgres/tests/mutation_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@ use sea_orm::Database;

#[tokio::test]
async fn main() {
test_simple_insert_one().await;
test_complex_insert_one().await;
test_create_batch_mutation().await;
test_update_mutation().await;
test_delete_mutation().await;
test_simple_insert_one().await;
test_complex_insert_one().await;
test_create_batch_mutation().await;
test_update_mutation().await;
test_delete_mutation().await;
}

pub async fn get_schema() -> Schema {
let database = Database::connect("postgres://sea:[email protected]/sakila")
.await
.unwrap();
let schema =
seaography_postgres_example::query_root::schema(database, None, None)
.unwrap();
let schema = seaography_postgres_example::query_root::schema(database, None, None).unwrap();

schema
}
Expand Down Expand Up @@ -599,7 +597,7 @@ async fn test_delete_mutation() {
"#,
)
.await,
r#"
r#"
{
"languageDelete": 2
}
Expand Down Expand Up @@ -632,4 +630,4 @@ async fn test_delete_mutation() {
}
"#,
);
}
}
6 changes: 2 additions & 4 deletions examples/postgres/tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ pub async fn get_schema() -> Schema {
let database = Database::connect("postgres://sea:[email protected]/sakila")
.await
.unwrap();
let schema =
seaography_postgres_example::query_root::schema(database, None, None)
.unwrap();
let schema = seaography_postgres_example::query_root::schema(database, None, None).unwrap();

schema
}
Expand Down Expand Up @@ -918,4 +916,4 @@ async fn test_boolean_field() {
}
"#,
)
}
}
23 changes: 12 additions & 11 deletions examples/sqlite/tests/mutation_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use sea_orm::Database;

#[tokio::test]
async fn main() {
test_simple_insert_one().await;
test_complex_insert_one().await;
test_create_batch_mutation().await;
test_update_mutation().await;
test_delete_mutation().await;
test_simple_insert_one().await;
test_complex_insert_one().await;
test_create_batch_mutation().await;
test_update_mutation().await;
test_delete_mutation().await;
}

pub async fn get_schema() -> Schema {
Expand Down Expand Up @@ -501,8 +501,9 @@ async fn test_update_mutation() {
async fn test_delete_mutation() {
let schema = get_schema().await;

schema.execute(
r#"
schema
.execute(
r#"
mutation {
filmTextCreateBatch(
data: [
Expand All @@ -514,9 +515,9 @@ async fn test_delete_mutation() {
filmId
}
}
"#
)
.await;
"#,
)
.await;

assert_eq(
schema
Expand Down Expand Up @@ -565,7 +566,7 @@ async fn test_delete_mutation() {
"#,
)
.await,
r#"
r#"
{
"filmTextDelete": 2
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
//! * Mutations (create, update, delete)
//!
//! (Right now there is no mutation, but it's on our plan!)
//!
//!
//! ## SeaORM Version Compatibility
//!
//!
//! | Seaography | SeaORM |
//! |----------------------------------------------------------|-------------------------------------------------------|
//! | [0.12](https://crates.io/crates/seaography/0.12.0) | [0.12](https://crates.io/crates/sea-orm/0.12.14) |
Expand Down

0 comments on commit a1148a8

Please sign in to comment.