From 12bbb6808105a9a5f86c5ea5a384131953c17eb4 Mon Sep 17 00:00:00 2001 From: Yiu Tin Cheung Ivan Date: Fri, 14 Jul 2023 19:00:29 +0800 Subject: [PATCH 1/8] version update, all examples marked with #notcomplete does not compile with cargo run --- examples/actix_example/api/Cargo.toml | 6 +++--- examples/axum_example/api/Cargo.toml | 19 +++++++++++-------- examples/basic/Cargo.toml | 4 +++- examples/graphql_example/api/Cargo.toml | 8 +++++--- examples/jsonrpsee_example/api/Cargo.toml | 12 +++++++----- examples/poem_example/api/Cargo.toml | 6 +++--- examples/rocket_example/api/Cargo.toml | 2 +- examples/salvo_example/api/Cargo.toml | 8 +++++--- examples/tonic_example/Cargo.toml | 4 ++-- examples/tonic_example/api/Cargo.toml | 6 +++--- 10 files changed, 43 insertions(+), 32 deletions(-) diff --git a/examples/actix_example/api/Cargo.toml b/examples/actix_example/api/Cargo.toml index 18374e707..44d4f3a03 100644 --- a/examples/actix_example/api/Cargo.toml +++ b/examples/actix_example/api/Cargo.toml @@ -9,12 +9,12 @@ publish = false actix-example-service = { path = "../service" } actix-files = "0.6" actix-http = "3" -actix-rt = "2.7" +actix-rt = "2.8" actix-service = "2" actix-web = "4" -tera = "1.15.0" +tera = "1.19.0" dotenvy = "0.15" -listenfd = "0.5" +listenfd = "1" serde = "1" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } entity = { path = "../entity" } diff --git a/examples/axum_example/api/Cargo.toml b/examples/axum_example/api/Cargo.toml index 541034e39..6eb77a818 100644 --- a/examples/axum_example/api/Cargo.toml +++ b/examples/axum_example/api/Cargo.toml @@ -7,16 +7,19 @@ publish = false [dependencies] axum-example-service = { path = "../service" } -tokio = { version = "1.23.0", features = ["full"] } -axum = "0.6.1" +tokio = { version = "1.29.0", features = ["full"] } +axum = "0.6.18" tower = "0.4.13" -tower-http = { version = "0.3.5", features = ["fs"] } -tower-cookies = "0.8.0" -anyhow = "1.0.66" -dotenvy = "0.15.6" -serde = "1.0.149" -serde_json = "1.0.89" +tower-http = { version = "0.4.1", features = ["fs"] } +# todo: tower-http should be updated to 0.4.1 +tower-cookies = "0.9.0" +anyhow = "1.0.71" +dotenvy = "0.15.7" +serde = "1.0.171" +serde_json = "1.0.102" tera = "1.17.1" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } entity = { path = "../entity" } migration = { path = "../migration" } + +#notcomplete, http issue \ No newline at end of file diff --git a/examples/basic/Cargo.toml b/examples/basic/Cargo.toml index 4c36d6cc9..5f7eb4559 100644 --- a/examples/basic/Cargo.toml +++ b/examples/basic/Cargo.toml @@ -8,9 +8,11 @@ edition = "2021" publish = false [dependencies] -async-std = { version = "1.9", features = [ "attributes", "tokio1" ] } +async-std = { version = "1.12", features = [ "attributes", "tokio1" ] } sea-orm = { path = "../../", features = [ "sqlx-all", "runtime-async-std-native-tls" ] } serde_json = { version = "1" } futures = { version = "0.3" } async-stream = { version = "0.3" } futures-util = { version = "0.3" } + +#unsure, connection driver issue \ No newline at end of file diff --git a/examples/graphql_example/api/Cargo.toml b/examples/graphql_example/api/Cargo.toml index 1115d8396..87a91b8d0 100644 --- a/examples/graphql_example/api/Cargo.toml +++ b/examples/graphql_example/api/Cargo.toml @@ -7,9 +7,11 @@ publish = false [dependencies] graphql-example-service = { path = "../service" } -tokio = { version = "1.0", features = ["full"] } -axum = "0.5.1" -dotenvy = "0.15.0" +tokio = { version = "1.29", features = ["full"] } +axum = "0.6.18" +dotenvy = "0.15.7" async-graphql-axum = "4.0.6" entity = { path = "../entity" } migration = { path = "../migration" } + +#notcomplete, axum issue \ No newline at end of file diff --git a/examples/jsonrpsee_example/api/Cargo.toml b/examples/jsonrpsee_example/api/Cargo.toml index fc8883917..9d9f157db 100644 --- a/examples/jsonrpsee_example/api/Cargo.toml +++ b/examples/jsonrpsee_example/api/Cargo.toml @@ -6,14 +6,16 @@ publish = false [dependencies] jsonrpsee-example-service = { path = "../service" } -jsonrpsee = { version = "0.8.0", features = ["full"] } -jsonrpsee-core = "0.9.0" -tokio = { version = "1.8.0", features = ["full"] } +jsonrpsee = { version = "0.18.2", features = ["full"] } +jsonrpsee-core = "0.18.2" +tokio = { version = "1.29.1", features = ["full"] } serde = { version = "1", features = ["derive"] } dotenvy = "0.15" entity = { path = "../entity" } migration = { path = "../migration" } -anyhow = "1.0.52" -async-trait = "0.1.52" +anyhow = "1.0.71" +async-trait = "0.1.71" log = { version = "0.4", features = ["std"] } simplelog = "0.12" + +#notcomplete \ No newline at end of file diff --git a/examples/poem_example/api/Cargo.toml b/examples/poem_example/api/Cargo.toml index 383843f4a..1830c52dd 100644 --- a/examples/poem_example/api/Cargo.toml +++ b/examples/poem_example/api/Cargo.toml @@ -5,11 +5,11 @@ edition = "2021" [dependencies] poem-example-service = { path = "../service" } -tokio = { version = "1.15.0", features = ["macros", "rt-multi-thread"] } -poem = { version = "1.2.33", features = ["static-files"] } +tokio = { version = "1.29.0", features = ["macros", "rt-multi-thread"] } +poem = { version = "1.3.56", features = ["static-files"] } tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } serde = { version = "1", features = ["derive"] } -tera = "1.8.0" +tera = "1.19.0" dotenvy = "0.15" entity = { path = "../entity" } migration = { path = "../migration" } diff --git a/examples/rocket_example/api/Cargo.toml b/examples/rocket_example/api/Cargo.toml index bb2d5cdee..26269bcf2 100644 --- a/examples/rocket_example/api/Cargo.toml +++ b/examples/rocket_example/api/Cargo.toml @@ -20,7 +20,7 @@ rocket_dyn_templates = { version = "0.1.0-rc.1", features = [ serde_json = { version = "1" } entity = { path = "../entity" } migration = { path = "../migration" } -tokio = "1.20.0" +tokio = "1.29.0" [dependencies.sea-orm-rocket] path = "../../../sea-orm-rocket/lib" # remove this line in your own project and uncomment the following line diff --git a/examples/salvo_example/api/Cargo.toml b/examples/salvo_example/api/Cargo.toml index 6635ccbe2..4246e22ee 100644 --- a/examples/salvo_example/api/Cargo.toml +++ b/examples/salvo_example/api/Cargo.toml @@ -5,11 +5,13 @@ edition = "2021" [dependencies] salvo-example-service = { path = "../service" } -tokio = { version = "1.15.0", features = ["macros", "rt-multi-thread"] } -salvo = { version = "0.27", features = ["affix", "serve-static"] } +tokio = { version = "1.29.0", features = ["macros", "rt-multi-thread"] } +salvo = { version = "0.46", features = ["affix", "serve-static"] } tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } serde = { version = "1", features = ["derive"] } -tera = "1.8.0" +tera = "1.19.0" dotenvy = "0.15" entity = { path = "../entity" } migration = { path = "../migration" } + +#notcomplete \ No newline at end of file diff --git a/examples/tonic_example/Cargo.toml b/examples/tonic_example/Cargo.toml index 115d1cb0f..c23ee975d 100644 --- a/examples/tonic_example/Cargo.toml +++ b/examples/tonic_example/Cargo.toml @@ -11,8 +11,8 @@ members = [".", "api", "service", "entity", "migration"] [dependencies] tonic-example-api = { path = "api" } -tonic = "0.7" -tokio = { version = "1.17", features = ["macros", "rt-multi-thread", "full"] } +tonic = "0.9.2" +tokio = { version = "1.29", features = ["macros", "rt-multi-thread", "full"] } [[bin]] name = "server" diff --git a/examples/tonic_example/api/Cargo.toml b/examples/tonic_example/api/Cargo.toml index 6d1e650cf..f9f0203f4 100644 --- a/examples/tonic_example/api/Cargo.toml +++ b/examples/tonic_example/api/Cargo.toml @@ -6,11 +6,11 @@ publish = false [dependencies] tonic-example-service = { path = "../service" } -tonic = "0.7" -tokio = { version = "1.17", features = ["macros", "rt-multi-thread", "full"] } +tonic = "0.9.2" +tokio = { version = "1.29", features = ["macros", "rt-multi-thread", "full"] } entity = { path = "../entity" } migration = { path = "../migration" } -prost = "0.10.0" +prost = "0.11.9" serde = "1.0" [lib] From cee8ea9aeccb5bf1d7c9516e5e467859768e668c Mon Sep 17 00:00:00 2001 From: Yiu Tin Cheung Ivan Date: Mon, 24 Jul 2023 17:03:33 +0800 Subject: [PATCH 2/8] WIP --- examples/axum_example/api/Cargo.toml | 9 +++------ examples/axum_example/api/src/lib.rs | 2 +- examples/graphql_example/api/Cargo.toml | 3 ++- examples/graphql_example/api/src/lib.rs | 8 +++++--- examples/graphql_example/entity/Cargo.toml | 2 +- examples/jsonrpsee_example/api/Cargo.toml | 4 +--- examples/jsonrpsee_example/api/src/lib.rs | 23 +++++++++++----------- examples/rocket_example/api/Cargo.toml | 1 + examples/salvo_example/api/Cargo.toml | 2 +- examples/salvo_example/api/src/lib.rs | 5 ++--- 10 files changed, 29 insertions(+), 30 deletions(-) diff --git a/examples/axum_example/api/Cargo.toml b/examples/axum_example/api/Cargo.toml index 6eb77a818..7ebfebf2d 100644 --- a/examples/axum_example/api/Cargo.toml +++ b/examples/axum_example/api/Cargo.toml @@ -8,10 +8,9 @@ publish = false [dependencies] axum-example-service = { path = "../service" } tokio = { version = "1.29.0", features = ["full"] } -axum = "0.6.18" +axum = "0.6.19" tower = "0.4.13" -tower-http = { version = "0.4.1", features = ["fs"] } -# todo: tower-http should be updated to 0.4.1 +tower-http = { version = "0.4.3", features = ["fs"] } tower-cookies = "0.9.0" anyhow = "1.0.71" dotenvy = "0.15.7" @@ -20,6 +19,4 @@ serde_json = "1.0.102" tera = "1.17.1" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } entity = { path = "../entity" } -migration = { path = "../migration" } - -#notcomplete, http issue \ No newline at end of file +migration = { path = "../migration" } \ No newline at end of file diff --git a/examples/axum_example/api/src/lib.rs b/examples/axum_example/api/src/lib.rs index 324840337..28a7572b9 100644 --- a/examples/axum_example/api/src/lib.rs +++ b/examples/axum_example/api/src/lib.rs @@ -53,7 +53,7 @@ async fn start() -> anyhow::Result<()> { env!("CARGO_MANIFEST_DIR"), "/static" ))) - .handle_error(|error: std::io::Error| async move { + .handle_error(|error| async move { ( StatusCode::INTERNAL_SERVER_ERROR, format!("Unhandled internal error: {error}"), diff --git a/examples/graphql_example/api/Cargo.toml b/examples/graphql_example/api/Cargo.toml index 87a91b8d0..2149df215 100644 --- a/examples/graphql_example/api/Cargo.toml +++ b/examples/graphql_example/api/Cargo.toml @@ -9,8 +9,9 @@ publish = false graphql-example-service = { path = "../service" } tokio = { version = "1.29", features = ["full"] } axum = "0.6.18" +axum-macros = "0.3" dotenvy = "0.15.7" -async-graphql-axum = "4.0.6" +async-graphql-axum = "5.0.10" entity = { path = "../entity" } migration = { path = "../migration" } diff --git a/examples/graphql_example/api/src/lib.rs b/examples/graphql_example/api/src/lib.rs index 85275fcbe..c35e05872 100644 --- a/examples/graphql_example/api/src/lib.rs +++ b/examples/graphql_example/api/src/lib.rs @@ -6,17 +6,19 @@ use entity::async_graphql; use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; use async_graphql_axum::{GraphQLRequest, GraphQLResponse}; use axum::{ - extract::Extension, + extract::State, response::{Html, IntoResponse}, routing::get, Router, }; use graphql::schema::{build_schema, AppSchema}; +use axum_macros::debug_handler; #[cfg(debug_assertions)] use dotenvy::dotenv; -async fn graphql_handler(schema: Extension, req: GraphQLRequest) -> GraphQLResponse { +#[debug_handler] +async fn graphql_handler(schema: State, req: GraphQLRequest) -> GraphQLResponse { schema.execute(req.into_inner()).await.into() } @@ -38,7 +40,7 @@ pub async fn main() { "/api/graphql", get(graphql_playground).post(graphql_handler), ) - .layer(Extension(schema)); + .with_state(schema); println!("Playground: http://localhost:3000/api/graphql"); diff --git a/examples/graphql_example/entity/Cargo.toml b/examples/graphql_example/entity/Cargo.toml index 1c6b5a5b5..74812d24c 100644 --- a/examples/graphql_example/entity/Cargo.toml +++ b/examples/graphql_example/entity/Cargo.toml @@ -12,7 +12,7 @@ path = "src/lib.rs" serde = { version = "1", features = ["derive"] } [dependencies.async-graphql] -version = "4.0.6" +version = "5.0.10" [dependencies.sea-orm] path = "../../../" # remove this line in your own project diff --git a/examples/jsonrpsee_example/api/Cargo.toml b/examples/jsonrpsee_example/api/Cargo.toml index 9d9f157db..77b5d9853 100644 --- a/examples/jsonrpsee_example/api/Cargo.toml +++ b/examples/jsonrpsee_example/api/Cargo.toml @@ -16,6 +16,4 @@ migration = { path = "../migration" } anyhow = "1.0.71" async-trait = "0.1.71" log = { version = "0.4", features = ["std"] } -simplelog = "0.12" - -#notcomplete \ No newline at end of file +simplelog = "0.12" \ No newline at end of file diff --git a/examples/jsonrpsee_example/api/src/lib.rs b/examples/jsonrpsee_example/api/src/lib.rs index de5252384..d93870a4e 100644 --- a/examples/jsonrpsee_example/api/src/lib.rs +++ b/examples/jsonrpsee_example/api/src/lib.rs @@ -1,11 +1,10 @@ use std::env; -use anyhow::anyhow; use entity::post; use jsonrpsee::core::{async_trait, RpcResult}; -use jsonrpsee::http_server::HttpServerBuilder; +use jsonrpsee::server::ServerBuilder; use jsonrpsee::proc_macros::rpc; -use jsonrpsee::types::error::CallError; +use jsonrpsee::types::error::ErrorObjectOwned; use jsonrpsee_example_service::sea_orm::{Database, DatabaseConnection}; use jsonrpsee_example_service::{Mutation, Query}; use log::info; @@ -14,7 +13,7 @@ use simplelog::*; use std::fmt::Display; use std::net::SocketAddr; use tokio::signal::ctrl_c; -use tokio::signal::unix::{signal, SignalKind}; +// use tokio::signal::unix::{signal, SignalKind}; const DEFAULT_POSTS_PER_PAGE: u64 = 5; @@ -88,7 +87,9 @@ where E: Display, { fn internal_call_error(self) -> RpcResult { - self.map_err(|e| jsonrpsee::core::Error::Call(CallError::Failed(anyhow!("{}", e)))) + // Err(ErrorObjectOwned::owned(1, "c", None::<()>)) + // self.map_err(|e| jsonrpsee::core::Error::Call(CallError::Failed(anyhow!("{}", e)))) + self.map_err(|e| ErrorObjectOwned::owned(1, format!("{}", e), None::<()>)) } } @@ -112,21 +113,21 @@ async fn start() -> std::io::Result<()> { let conn = Database::connect(&db_url).await.unwrap(); Migrator::up(&conn, None).await.unwrap(); - let server = HttpServerBuilder::default() + let server = ServerBuilder::default() .build(server_url.parse::().unwrap()) - .unwrap(); + .await.unwrap(); let rpc_impl = PpcImpl { conn }; let server_addr = server.local_addr().unwrap(); let handle = server.start(rpc_impl.into_rpc()).unwrap(); info!("starting listening {}", server_addr); - let mut sig_int = signal(SignalKind::interrupt()).unwrap(); - let mut sig_term = signal(SignalKind::terminate()).unwrap(); + // let mut sig_int = signal(SignalKind::interrupt()).unwrap(); + // let mut sig_term = signal(SignalKind::terminate()).unwrap(); tokio::select! { - _ = sig_int.recv() => info!("receive SIGINT"), - _ = sig_term.recv() => info!("receive SIGTERM"), + // _ = sig_int.recv() => info!("receive SIGINT"), + // _ = sig_term.recv() => info!("receive SIGTERM"), _ = ctrl_c() => info!("receive Ctrl C"), } handle.stop().unwrap(); diff --git a/examples/rocket_example/api/Cargo.toml b/examples/rocket_example/api/Cargo.toml index 26269bcf2..7cac2aff9 100644 --- a/examples/rocket_example/api/Cargo.toml +++ b/examples/rocket_example/api/Cargo.toml @@ -25,3 +25,4 @@ tokio = "1.29.0" [dependencies.sea-orm-rocket] path = "../../../sea-orm-rocket/lib" # remove this line in your own project and uncomment the following line # version = "0.5.2" + diff --git a/examples/salvo_example/api/Cargo.toml b/examples/salvo_example/api/Cargo.toml index 4246e22ee..26821c337 100644 --- a/examples/salvo_example/api/Cargo.toml +++ b/examples/salvo_example/api/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] salvo-example-service = { path = "../service" } tokio = { version = "1.29.0", features = ["macros", "rt-multi-thread"] } -salvo = { version = "0.46", features = ["affix", "serve-static"] } +salvo = { version = "0.49", features = ["affix", "serve-static"] } tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } serde = { version = "1", features = ["derive"] } tera = "1.19.0" diff --git a/examples/salvo_example/api/src/lib.rs b/examples/salvo_example/api/src/lib.rs index 76927c953..bf91c02f2 100644 --- a/examples/salvo_example/api/src/lib.rs +++ b/examples/salvo_example/api/src/lib.rs @@ -2,10 +2,9 @@ use std::env; use entity::post; use migration::{Migrator, MigratorTrait}; -use salvo::extra::affix; -use salvo::extra::serve_static::DirHandler; +use salvo::salvo_extra::affix; +use salvo::salvo_extra::serve_static::DirHandler; use salvo::prelude::*; -use salvo::writer::Text; use salvo_example_service::{ sea_orm::{Database, DatabaseConnection}, Mutation, Query, From 214737df3192885b06303eba753a192f95ad9328 Mon Sep 17 00:00:00 2001 From: Yiu Tin Cheung Ivan Date: Tue, 25 Jul 2023 12:19:30 +0800 Subject: [PATCH 3/8] salvo example fixed --- examples/salvo_example/api/src/lib.rs | 18 +++++++++--------- examples/salvo_example/entity/Cargo.toml | 1 + examples/salvo_example/entity/src/post.rs | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/examples/salvo_example/api/src/lib.rs b/examples/salvo_example/api/src/lib.rs index bf91c02f2..cd867e4ae 100644 --- a/examples/salvo_example/api/src/lib.rs +++ b/examples/salvo_example/api/src/lib.rs @@ -2,8 +2,7 @@ use std::env; use entity::post; use migration::{Migrator, MigratorTrait}; -use salvo::salvo_extra::affix; -use salvo::salvo_extra::serve_static::DirHandler; +use salvo::affix; use salvo::prelude::*; use salvo_example_service::{ sea_orm::{Database, DatabaseConnection}, @@ -27,8 +26,9 @@ async fn create(req: &mut Request, depot: &mut Depot, res: &mut Response) -> Res .ok_or_else(StatusError::internal_server_error)?; let conn = &state.conn; + let form = req - .extract_form::() + .parse_form::() .await .map_err(|_| StatusError::bad_request())?; @@ -36,7 +36,7 @@ async fn create(req: &mut Request, depot: &mut Depot, res: &mut Response) -> Res .await .map_err(|_| StatusError::internal_server_error())?; - res.redirect_found("/"); + Redirect::found("/").render(res); Ok(()) } @@ -113,7 +113,7 @@ async fn update(req: &mut Request, depot: &mut Depot, res: &mut Response) -> Res let conn = &state.conn; let id = req.param::("id").unwrap_or_default(); let form = req - .extract_form::() + .parse_form::() .await .map_err(|_| StatusError::bad_request())?; @@ -121,7 +121,7 @@ async fn update(req: &mut Request, depot: &mut Depot, res: &mut Response) -> Res .await .map_err(|_| StatusError::internal_server_error())?; - res.redirect_found("/"); + Redirect::found("/").render(res); Ok(()) } @@ -137,7 +137,7 @@ async fn delete(req: &mut Request, depot: &mut Depot, res: &mut Response) -> Res .await .map_err(|_| StatusError::internal_server_error())?; - res.redirect_found("/"); + Redirect::found("/").render(res); Ok(()) } @@ -169,13 +169,13 @@ pub async fn main() { .push(Router::with_path("").get(edit).post(update)) .push(Router::with_path("delete/").post(delete)) .push( - Router::with_path("static/<**>").get(DirHandler::new(concat!( + Router::with_path("static/<**>").get(salvo::prelude::StaticDir::new(concat!( env!("CARGO_MANIFEST_DIR"), "/static" ))), ); - Server::new(TcpListener::bind(&format!("{host}:{port}"))) + Server::new(TcpListener::bind(TcpListener::new(format!("{host}:{port}"))).await) .serve(router) .await; } diff --git a/examples/salvo_example/entity/Cargo.toml b/examples/salvo_example/entity/Cargo.toml index 5171c39b8..dfc8470e8 100644 --- a/examples/salvo_example/entity/Cargo.toml +++ b/examples/salvo_example/entity/Cargo.toml @@ -10,6 +10,7 @@ path = "src/lib.rs" [dependencies] serde = { version = "1", features = ["derive"] } +salvo = { version = "0.49" } [dependencies.sea-orm] path = "../../../" # remove this line in your own project diff --git a/examples/salvo_example/entity/src/post.rs b/examples/salvo_example/entity/src/post.rs index 62cde830c..734aad64e 100644 --- a/examples/salvo_example/entity/src/post.rs +++ b/examples/salvo_example/entity/src/post.rs @@ -1,7 +1,8 @@ use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; +use salvo::prelude::Extractible; -#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Extractible, Deserialize, Serialize)] #[sea_orm(table_name = "posts")] pub struct Model { #[sea_orm(primary_key)] From 17a9f7d9c105f66c1dab71b977c80a27cc4bea5a Mon Sep 17 00:00:00 2001 From: Yiu Tin Cheung Ivan Date: Tue, 25 Jul 2023 13:58:46 +0800 Subject: [PATCH 4/8] testing, and boost a minor version --- examples/axum_example/api/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/axum_example/api/Cargo.toml b/examples/axum_example/api/Cargo.toml index 7ebfebf2d..e682bf37f 100644 --- a/examples/axum_example/api/Cargo.toml +++ b/examples/axum_example/api/Cargo.toml @@ -14,7 +14,7 @@ tower-http = { version = "0.4.3", features = ["fs"] } tower-cookies = "0.9.0" anyhow = "1.0.71" dotenvy = "0.15.7" -serde = "1.0.171" +serde = "1.0.175" serde_json = "1.0.102" tera = "1.17.1" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } From a9643be4ceba6640c3a773a7287d28541de9e479 Mon Sep 17 00:00:00 2001 From: Yiu Tin Cheung Ivan Date: Tue, 25 Jul 2023 14:16:34 +0800 Subject: [PATCH 5/8] fmt --- examples/graphql_example/api/src/lib.rs | 2 +- examples/jsonrpsee_example/api/src/lib.rs | 5 +++-- examples/salvo_example/api/src/lib.rs | 3 +-- examples/salvo_example/entity/src/post.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/graphql_example/api/src/lib.rs b/examples/graphql_example/api/src/lib.rs index c35e05872..51cbc68a6 100644 --- a/examples/graphql_example/api/src/lib.rs +++ b/examples/graphql_example/api/src/lib.rs @@ -11,8 +11,8 @@ use axum::{ routing::get, Router, }; -use graphql::schema::{build_schema, AppSchema}; use axum_macros::debug_handler; +use graphql::schema::{build_schema, AppSchema}; #[cfg(debug_assertions)] use dotenvy::dotenv; diff --git a/examples/jsonrpsee_example/api/src/lib.rs b/examples/jsonrpsee_example/api/src/lib.rs index d93870a4e..2e0e27560 100644 --- a/examples/jsonrpsee_example/api/src/lib.rs +++ b/examples/jsonrpsee_example/api/src/lib.rs @@ -2,8 +2,8 @@ use std::env; use entity::post; use jsonrpsee::core::{async_trait, RpcResult}; -use jsonrpsee::server::ServerBuilder; use jsonrpsee::proc_macros::rpc; +use jsonrpsee::server::ServerBuilder; use jsonrpsee::types::error::ErrorObjectOwned; use jsonrpsee_example_service::sea_orm::{Database, DatabaseConnection}; use jsonrpsee_example_service::{Mutation, Query}; @@ -115,7 +115,8 @@ async fn start() -> std::io::Result<()> { let server = ServerBuilder::default() .build(server_url.parse::().unwrap()) - .await.unwrap(); + .await + .unwrap(); let rpc_impl = PpcImpl { conn }; let server_addr = server.local_addr().unwrap(); diff --git a/examples/salvo_example/api/src/lib.rs b/examples/salvo_example/api/src/lib.rs index cd867e4ae..6b1aa0fbd 100644 --- a/examples/salvo_example/api/src/lib.rs +++ b/examples/salvo_example/api/src/lib.rs @@ -26,7 +26,6 @@ async fn create(req: &mut Request, depot: &mut Depot, res: &mut Response) -> Res .ok_or_else(StatusError::internal_server_error)?; let conn = &state.conn; - let form = req .parse_form::() .await @@ -36,7 +35,7 @@ async fn create(req: &mut Request, depot: &mut Depot, res: &mut Response) -> Res .await .map_err(|_| StatusError::internal_server_error())?; - Redirect::found("/").render(res); + Redirect::found("/").render(res); Ok(()) } diff --git a/examples/salvo_example/entity/src/post.rs b/examples/salvo_example/entity/src/post.rs index 734aad64e..7223abc74 100644 --- a/examples/salvo_example/entity/src/post.rs +++ b/examples/salvo_example/entity/src/post.rs @@ -1,6 +1,6 @@ +use salvo::prelude::Extractible; use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -use salvo::prelude::Extractible; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Extractible, Deserialize, Serialize)] #[sea_orm(table_name = "posts")] From 3bccf8a09a47371fe44c1004c78a3621c6aa6e81 Mon Sep 17 00:00:00 2001 From: Yiu Tin Cheung Ivan Date: Tue, 25 Jul 2023 14:59:22 +0800 Subject: [PATCH 6/8] build dependency update --- examples/tonic_example/api/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tonic_example/api/Cargo.toml b/examples/tonic_example/api/Cargo.toml index f9f0203f4..886830347 100644 --- a/examples/tonic_example/api/Cargo.toml +++ b/examples/tonic_example/api/Cargo.toml @@ -17,4 +17,4 @@ serde = "1.0" path = "./src/lib.rs" [build-dependencies] -tonic-build = "0.7" +tonic-build = "0.9.2" From 2065b2ad1b974dd2eaf1d8eb20f84e73225ec301 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 25 Jul 2023 15:32:35 +0800 Subject: [PATCH 7/8] CI --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2005f0744..a9d78ff89 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -247,6 +247,8 @@ jobs: path: ${{ fromJson(needs.examples-matrix.outputs.path_matrix) }} steps: - uses: actions/checkout@v3 + - if: ${{ contains(matrix.path, 'tonic_example') }} + uses: arduino/setup-protoc@v1 - uses: dtolnay/rust-toolchain@master with: toolchain: stable From 5c1369e1ebec0dc960842cd3152caa9e282ee74f Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 25 Jul 2023 15:42:39 +0800 Subject: [PATCH 8/8] cleanup --- examples/axum_example/api/Cargo.toml | 2 +- examples/basic/Cargo.toml | 4 +--- examples/graphql_example/api/Cargo.toml | 4 +--- examples/jsonrpsee_example/api/Cargo.toml | 2 +- examples/rocket_example/api/Cargo.toml | 1 - examples/salvo_example/api/Cargo.toml | 4 +--- 6 files changed, 5 insertions(+), 12 deletions(-) diff --git a/examples/axum_example/api/Cargo.toml b/examples/axum_example/api/Cargo.toml index e682bf37f..de7462e48 100644 --- a/examples/axum_example/api/Cargo.toml +++ b/examples/axum_example/api/Cargo.toml @@ -19,4 +19,4 @@ serde_json = "1.0.102" tera = "1.17.1" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } entity = { path = "../entity" } -migration = { path = "../migration" } \ No newline at end of file +migration = { path = "../migration" } diff --git a/examples/basic/Cargo.toml b/examples/basic/Cargo.toml index 5f7eb4559..36f258443 100644 --- a/examples/basic/Cargo.toml +++ b/examples/basic/Cargo.toml @@ -13,6 +13,4 @@ sea-orm = { path = "../../", features = [ "sqlx-all", "runtime-async-std-native- serde_json = { version = "1" } futures = { version = "0.3" } async-stream = { version = "0.3" } -futures-util = { version = "0.3" } - -#unsure, connection driver issue \ No newline at end of file +futures-util = { version = "0.3" } \ No newline at end of file diff --git a/examples/graphql_example/api/Cargo.toml b/examples/graphql_example/api/Cargo.toml index 2149df215..2ffb5544c 100644 --- a/examples/graphql_example/api/Cargo.toml +++ b/examples/graphql_example/api/Cargo.toml @@ -13,6 +13,4 @@ axum-macros = "0.3" dotenvy = "0.15.7" async-graphql-axum = "5.0.10" entity = { path = "../entity" } -migration = { path = "../migration" } - -#notcomplete, axum issue \ No newline at end of file +migration = { path = "../migration" } \ No newline at end of file diff --git a/examples/jsonrpsee_example/api/Cargo.toml b/examples/jsonrpsee_example/api/Cargo.toml index 77b5d9853..32693934e 100644 --- a/examples/jsonrpsee_example/api/Cargo.toml +++ b/examples/jsonrpsee_example/api/Cargo.toml @@ -16,4 +16,4 @@ migration = { path = "../migration" } anyhow = "1.0.71" async-trait = "0.1.71" log = { version = "0.4", features = ["std"] } -simplelog = "0.12" \ No newline at end of file +simplelog = "0.12" diff --git a/examples/rocket_example/api/Cargo.toml b/examples/rocket_example/api/Cargo.toml index 7cac2aff9..26269bcf2 100644 --- a/examples/rocket_example/api/Cargo.toml +++ b/examples/rocket_example/api/Cargo.toml @@ -25,4 +25,3 @@ tokio = "1.29.0" [dependencies.sea-orm-rocket] path = "../../../sea-orm-rocket/lib" # remove this line in your own project and uncomment the following line # version = "0.5.2" - diff --git a/examples/salvo_example/api/Cargo.toml b/examples/salvo_example/api/Cargo.toml index 26821c337..460425de2 100644 --- a/examples/salvo_example/api/Cargo.toml +++ b/examples/salvo_example/api/Cargo.toml @@ -12,6 +12,4 @@ serde = { version = "1", features = ["derive"] } tera = "1.19.0" dotenvy = "0.15" entity = { path = "../entity" } -migration = { path = "../migration" } - -#notcomplete \ No newline at end of file +migration = { path = "../migration" } \ No newline at end of file