From 7fd82fd66d25e96b15788849f860d2b8260a7214 Mon Sep 17 00:00:00 2001 From: gudaoxuri Date: Fri, 29 Jul 2022 11:13:19 +0800 Subject: [PATCH] Hide common three-party dependencies. close #11 --- README.md | 14 ++++++++-- examples/Cargo.toml | 13 --------- examples/cache/Cargo.toml | 1 + examples/cache/src/main.rs | 1 - examples/mq/Cargo.toml | 1 + examples/multi-apps/Cargo.toml | 1 + examples/multi-apps/doc/Cargo.toml | 4 +-- examples/multi-apps/doc/src/api/doc_api.rs | 5 ++-- examples/multi-apps/doc/src/domain/doc.rs | 1 + examples/multi-apps/doc/src/dto/doc_dto.rs | 4 +-- examples/multi-apps/tag/Cargo.toml | 4 +-- examples/multi-apps/tag/src/api/tag_api.rs | 10 +++---- examples/multi-apps/tag/src/domain/tag.rs | 1 + examples/multi-apps/tag/src/dto/tag_dto.rs | 8 +++--- examples/perf-test/Cargo.toml | 7 ++--- examples/perf-test/src/domain/todos.rs | 1 + examples/perf-test/src/processor.rs | 12 ++++---- examples/reldb/Cargo.toml | 4 +-- examples/reldb/src/domain/account.rs | 1 + examples/reldb/src/domain/app.rs | 1 + examples/reldb/src/domain/app_account_rel.rs | 1 + examples/reldb/src/domain/tenant.rs | 1 + examples/reldb/src/domain/tenant_conf.rs | 1 + examples/todos/Cargo.toml | 6 +--- examples/todos/src/domain/todos.rs | 1 + examples/todos/src/processor.rs | 12 ++++---- examples/web-basic/Cargo.toml | 3 +- examples/web-basic/src/processor.rs | 4 +-- examples/web-client/Cargo.toml | 1 + examples/webscoket/Cargo.toml | 4 +-- examples/webscoket/src/processor.rs | 8 +++--- src/db.rs | 1 - src/lib.rs | 29 +++++++++++++------- 33 files changed, 87 insertions(+), 79 deletions(-) delete mode 100644 examples/Cargo.toml diff --git a/README.md b/README.md index a17af8ca..31ee349d 100644 --- a/README.md +++ b/README.md @@ -64,14 +64,18 @@ Dependency Configuration ```toml [dependencies] tardis = { version = "^0", features = ["web-server"] } -poem-openapi = { version = "^2"} ``` Processor Configuration ```ignore +use tardis::basic::error::TardisError; +use tardis::web::poem_openapi; +use tardis::web::poem_openapi::param::Query; +use tardis::web::web_resp::{TardisApiResult, TardisResp}; + pub struct Api; -#[OpenApi] +#[poem_openapi::OpenApi] impl Api { #[oai(path = "/hello", method = "get")] async fn index(&self, name: Query>) -> TardisResult { @@ -85,6 +89,12 @@ impl Api { Startup class configuration ```ignore +use tardis::basic::result::TardisResult; +use tardis::tokio; +use tardis::TardisFuns; +use crate::processor::Api; +mod processor; + #[tokio::main] async fn main() -> TardisResult<()> { // Initial configuration diff --git a/examples/Cargo.toml b/examples/Cargo.toml deleted file mode 100644 index 94a349f7..00000000 --- a/examples/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[workspace] - -members = [ - "reldb", - "web-basic", - "webscoket", - "web-client", - "cache", - "mq", - "todos", - "perf-test", - "multi-apps", -] diff --git a/examples/cache/Cargo.toml b/examples/cache/Cargo.toml index 4b66d1d8..c11b28c3 100644 --- a/examples/cache/Cargo.toml +++ b/examples/cache/Cargo.toml @@ -3,6 +3,7 @@ name = "tardis-example-cache" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] tardis = { path = "../..", features = ["cache", "test"] } diff --git a/examples/cache/src/main.rs b/examples/cache/src/main.rs index fa507809..38e87405 100644 --- a/examples/cache/src/main.rs +++ b/examples/cache/src/main.rs @@ -1,6 +1,5 @@ use std::env; use std::time::Duration; - use tardis::basic::result::TardisResult; use tardis::test::test_container::TardisTestContainer; use tardis::testcontainers::clients; diff --git a/examples/mq/Cargo.toml b/examples/mq/Cargo.toml index 4b3a5a25..aac79ebb 100644 --- a/examples/mq/Cargo.toml +++ b/examples/mq/Cargo.toml @@ -3,6 +3,7 @@ name = "tardis-example-mq" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] tardis = { path = "../..", features = ["mq", "test"] } diff --git a/examples/multi-apps/Cargo.toml b/examples/multi-apps/Cargo.toml index 2d20530c..217360fd 100644 --- a/examples/multi-apps/Cargo.toml +++ b/examples/multi-apps/Cargo.toml @@ -3,6 +3,7 @@ name = "tardis-example-multi-apps" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] tardis-example-multi-apps-doc = { path = "doc"} diff --git a/examples/multi-apps/doc/Cargo.toml b/examples/multi-apps/doc/Cargo.toml index 54e013ea..309f299a 100644 --- a/examples/multi-apps/doc/Cargo.toml +++ b/examples/multi-apps/doc/Cargo.toml @@ -3,10 +3,8 @@ name = "tardis-example-multi-apps-doc" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] serde = { version = "1", features = ["derive"] } - tardis = { path = "../../..", features = ["reldb", "web-server"] } -sea-orm = { version = "0.9", features = ["macros"] } -poem-openapi = { version = "2" } \ No newline at end of file diff --git a/examples/multi-apps/doc/src/api/doc_api.rs b/examples/multi-apps/doc/src/api/doc_api.rs index 7fa07798..e7e6e0fd 100644 --- a/examples/multi-apps/doc/src/api/doc_api.rs +++ b/examples/multi-apps/doc/src/api/doc_api.rs @@ -1,5 +1,6 @@ use tardis::web::context_extractor::TardisContextExtractor; -use tardis::web::poem_openapi::{payload::Json, OpenApi}; +use tardis::web::poem_openapi; +use tardis::web::poem_openapi::payload::Json; use tardis::web::web_resp::{TardisApiResult, TardisResp}; use tardis::TardisFuns; @@ -8,7 +9,7 @@ use crate::serv::doc_serv::DocServ; pub struct DocApi; -#[OpenApi(prefix_path = "/doc")] +#[poem_openapi::OpenApi(prefix_path = "/doc")] impl DocApi { /// Add #[oai(path = "/", method = "post")] diff --git a/examples/multi-apps/doc/src/domain/doc.rs b/examples/multi-apps/doc/src/domain/doc.rs index 4af8a2a1..b35851d7 100644 --- a/examples/multi-apps/doc/src/domain/doc.rs +++ b/examples/multi-apps/doc/src/domain/doc.rs @@ -1,5 +1,6 @@ use tardis::basic::dto::TardisContext; use tardis::db::reldb_client::TardisActiveModel; +use tardis::db::sea_orm; use tardis::db::sea_orm::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] diff --git a/examples/multi-apps/doc/src/dto/doc_dto.rs b/examples/multi-apps/doc/src/dto/doc_dto.rs index a66696b0..da3fd572 100644 --- a/examples/multi-apps/doc/src/dto/doc_dto.rs +++ b/examples/multi-apps/doc/src/dto/doc_dto.rs @@ -3,9 +3,9 @@ use std::fmt::Debug; use serde::{Deserialize, Serialize}; use tardis::basic::field::TrimString; -use tardis::web::poem_openapi::Object; +use tardis::web::poem_openapi; -#[derive(Object, Serialize, Deserialize, Debug)] +#[derive(poem_openapi::Object, Serialize, Deserialize, Debug)] pub struct DocAddReq { #[oai(validator(min_length = "2", max_length = "255"))] pub name: TrimString, diff --git a/examples/multi-apps/tag/Cargo.toml b/examples/multi-apps/tag/Cargo.toml index 33aac689..b14726e7 100644 --- a/examples/multi-apps/tag/Cargo.toml +++ b/examples/multi-apps/tag/Cargo.toml @@ -3,10 +3,8 @@ name = "tardis-example-multi-apps-tag" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] serde = { version = "1", features = ["derive"] } - tardis = { path = "../../..", features = ["reldb", "web-server"] } -sea-orm = { version = "0.9", features = ["macros"] } -poem-openapi = { version = "2" } diff --git a/examples/multi-apps/tag/src/api/tag_api.rs b/examples/multi-apps/tag/src/api/tag_api.rs index 2dde24ca..fbec71ef 100644 --- a/examples/multi-apps/tag/src/api/tag_api.rs +++ b/examples/multi-apps/tag/src/api/tag_api.rs @@ -1,14 +1,14 @@ +use crate::dto::tag_dto::{TagAddReq, TagResp}; +use crate::serv::tag_serv::TagServ; use tardis::web::context_extractor::TardisContextExtractor; -use tardis::web::poem_openapi::{payload::Json, OpenApi}; +use tardis::web::poem_openapi; +use tardis::web::poem_openapi::payload::Json; use tardis::web::web_resp::{TardisApiResult, TardisResp}; use tardis::TardisFuns; -use crate::dto::tag_dto::{TagAddReq, TagResp}; -use crate::serv::tag_serv::TagServ; - pub struct TagApi; -#[OpenApi(prefix_path = "/tag")] +#[poem_openapi::OpenApi(prefix_path = "/tag")] impl TagApi { /// Add #[oai(path = "/", method = "post")] diff --git a/examples/multi-apps/tag/src/domain/tag.rs b/examples/multi-apps/tag/src/domain/tag.rs index 9e535183..99b6330a 100644 --- a/examples/multi-apps/tag/src/domain/tag.rs +++ b/examples/multi-apps/tag/src/domain/tag.rs @@ -1,5 +1,6 @@ use tardis::basic::dto::TardisContext; use tardis::db::reldb_client::TardisActiveModel; +use tardis::db::sea_orm; use tardis::db::sea_orm::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] diff --git a/examples/multi-apps/tag/src/dto/tag_dto.rs b/examples/multi-apps/tag/src/dto/tag_dto.rs index 9e001b05..71684099 100644 --- a/examples/multi-apps/tag/src/dto/tag_dto.rs +++ b/examples/multi-apps/tag/src/dto/tag_dto.rs @@ -1,18 +1,18 @@ use std::fmt::Debug; -use sea_orm::FromQueryResult; use serde::{Deserialize, Serialize}; -use tardis::web::poem_openapi::Object; +use tardis::db::sea_orm; +use tardis::web::poem_openapi; -#[derive(Object, Serialize, Deserialize, Debug)] +#[derive(poem_openapi::Object, Serialize, Deserialize, Debug)] #[oai(rename_all = "camelCase")] pub struct TagAddReq { pub name: String, pub create_id: String, } -#[derive(Object, Serialize, Deserialize, Debug, FromQueryResult)] +#[derive(poem_openapi::Object, Serialize, Deserialize, Debug, sea_orm::FromQueryResult)] #[oai(rename_all = "camelCase")] pub struct TagResp { pub id: i32, diff --git a/examples/perf-test/Cargo.toml b/examples/perf-test/Cargo.toml index 6ae691aa..ea3d4b64 100644 --- a/examples/perf-test/Cargo.toml +++ b/examples/perf-test/Cargo.toml @@ -3,11 +3,8 @@ name = "tardis-example-perf-test" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] # Tardis Functions -tardis = { path = "../..", features = ["web-server", "reldb"] } -# Web server dependencies -poem-openapi = { version = "2" } -# Reldb dependencies -sea-orm = { version = "0.9", features = ["macros"] } +tardis = { path = "../..", features = ["web-server", "reldb"] } \ No newline at end of file diff --git a/examples/perf-test/src/domain/todos.rs b/examples/perf-test/src/domain/todos.rs index 09b86c2e..e7072cd6 100644 --- a/examples/perf-test/src/domain/todos.rs +++ b/examples/perf-test/src/domain/todos.rs @@ -1,5 +1,6 @@ use tardis::basic::dto::TardisContext; use tardis::db::reldb_client::TardisActiveModel; +use tardis::db::sea_orm; use tardis::db::sea_orm::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] diff --git a/examples/perf-test/src/processor.rs b/examples/perf-test/src/processor.rs index a86110f4..3c791faf 100644 --- a/examples/perf-test/src/processor.rs +++ b/examples/perf-test/src/processor.rs @@ -1,15 +1,17 @@ use tardis::basic::dto::TardisContext; +use tardis::db::sea_orm; use tardis::db::sea_orm::sea_query::Query as DbQuery; use tardis::db::sea_orm::*; use tardis::serde::{self, Deserialize, Serialize}; +use tardis::web::poem_openapi; use tardis::web::poem_openapi::param::Query; -use tardis::web::poem_openapi::{param::Path, payload::Json, Object, OpenApi}; +use tardis::web::poem_openapi::{param::Path, payload::Json}; use tardis::web::web_resp::{TardisApiResult, TardisPage, TardisResp}; use tardis::TardisFuns; use crate::domain::todos; -#[derive(Object, FromQueryResult, Serialize, Deserialize, Debug)] +#[derive(poem_openapi::Object, sea_orm::FromQueryResult, Serialize, Deserialize, Debug)] #[serde(crate = "self::serde")] struct TodoDetailResp { id: i32, @@ -17,7 +19,7 @@ struct TodoDetailResp { done: bool, } -#[derive(Object, Serialize, Deserialize, Debug)] +#[derive(poem_openapi::Object, Serialize, Deserialize, Debug)] #[serde(crate = "self::serde")] struct TodoAddReq { #[oai(validator(min_length = "2", max_length = "255"))] @@ -25,7 +27,7 @@ struct TodoAddReq { done: bool, } -#[derive(Object, Serialize, Deserialize, Debug)] +#[derive(poem_openapi::Object, Serialize, Deserialize, Debug)] #[serde(crate = "self::serde")] struct TodoModifyReq { #[oai(validator(min_length = "2", max_length = "255"))] @@ -35,7 +37,7 @@ struct TodoModifyReq { pub struct TodoApi; -#[OpenApi] +#[poem_openapi::OpenApi] impl TodoApi { #[oai(path = "/todo", method = "post")] async fn add(&self, todo_add_req: Json) -> TardisApiResult { diff --git a/examples/reldb/Cargo.toml b/examples/reldb/Cargo.toml index 7cbfeb0e..399b7579 100644 --- a/examples/reldb/Cargo.toml +++ b/examples/reldb/Cargo.toml @@ -3,7 +3,7 @@ name = "tardis-example-reldb" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] -tardis = { path = "../..", features = ["reldb", "test"] } -sea-orm = { version = "0.9", features = ["macros"] } +tardis = { path = "../..", features = ["reldb", "test"] } \ No newline at end of file diff --git a/examples/reldb/src/domain/account.rs b/examples/reldb/src/domain/account.rs index f11c82c7..2d6eb016 100644 --- a/examples/reldb/src/domain/account.rs +++ b/examples/reldb/src/domain/account.rs @@ -1,5 +1,6 @@ use tardis::basic::dto::TardisContext; use tardis::db::reldb_client::TardisActiveModel; +use tardis::db::sea_orm; use tardis::db::sea_orm::*; use tardis::TardisFuns; diff --git a/examples/reldb/src/domain/app.rs b/examples/reldb/src/domain/app.rs index 47a9f6fe..3a56b450 100644 --- a/examples/reldb/src/domain/app.rs +++ b/examples/reldb/src/domain/app.rs @@ -1,5 +1,6 @@ use tardis::basic::dto::TardisContext; use tardis::db::reldb_client::TardisActiveModel; +use tardis::db::sea_orm; use tardis::db::sea_orm::*; use tardis::TardisFuns; diff --git a/examples/reldb/src/domain/app_account_rel.rs b/examples/reldb/src/domain/app_account_rel.rs index 91491f37..c0b22d08 100644 --- a/examples/reldb/src/domain/app_account_rel.rs +++ b/examples/reldb/src/domain/app_account_rel.rs @@ -1,3 +1,4 @@ +use tardis::db::sea_orm; use tardis::db::sea_orm::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] diff --git a/examples/reldb/src/domain/tenant.rs b/examples/reldb/src/domain/tenant.rs index e443d609..e6445794 100644 --- a/examples/reldb/src/domain/tenant.rs +++ b/examples/reldb/src/domain/tenant.rs @@ -1,5 +1,6 @@ use tardis::basic::dto::TardisContext; use tardis::db::reldb_client::TardisActiveModel; +use tardis::db::sea_orm; use tardis::db::sea_orm::*; use tardis::TardisFuns; diff --git a/examples/reldb/src/domain/tenant_conf.rs b/examples/reldb/src/domain/tenant_conf.rs index 350644a9..54cd2456 100644 --- a/examples/reldb/src/domain/tenant_conf.rs +++ b/examples/reldb/src/domain/tenant_conf.rs @@ -1,5 +1,6 @@ use tardis::basic::dto::TardisContext; use tardis::db::reldb_client::TardisActiveModel; +use tardis::db::sea_orm; use tardis::db::sea_orm::*; use tardis::TardisFuns; diff --git a/examples/todos/Cargo.toml b/examples/todos/Cargo.toml index d39980ff..b6f3755e 100644 --- a/examples/todos/Cargo.toml +++ b/examples/todos/Cargo.toml @@ -3,13 +3,9 @@ name = "tardis-example-todos" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] serde = { version = "1", features = ["derive"] } # Tardis Functions tardis = { path = "../..", features = ["web-server", "reldb", "test"] } -# Web server dependencies -poem-openapi = { version = "2" } -# Reldb dependencies -sea-orm = { version = "0.9", features = ["macros"] } - diff --git a/examples/todos/src/domain/todos.rs b/examples/todos/src/domain/todos.rs index 05c48552..030fc599 100644 --- a/examples/todos/src/domain/todos.rs +++ b/examples/todos/src/domain/todos.rs @@ -1,5 +1,6 @@ use tardis::basic::dto::TardisContext; use tardis::db::reldb_client::TardisActiveModel; +use tardis::db::sea_orm; use tardis::db::sea_orm::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] diff --git a/examples/todos/src/processor.rs b/examples/todos/src/processor.rs index 49ee6f50..94933840 100644 --- a/examples/todos/src/processor.rs +++ b/examples/todos/src/processor.rs @@ -2,18 +2,20 @@ use serde::{Deserialize, Serialize}; use tardis::basic::error::TardisError; use tardis::basic::field::TrimString; +use tardis::db::sea_orm; use tardis::db::sea_orm::sea_query::Query as DbQuery; use tardis::db::sea_orm::*; use tardis::web::context_extractor::TardisContextExtractor; +use tardis::web::poem_openapi; use tardis::web::poem_openapi::param::Query; -use tardis::web::poem_openapi::{param::Path, payload::Json, Object, OpenApi}; +use tardis::web::poem_openapi::{param::Path, payload::Json}; use tardis::web::web_resp::{TardisApiResult, Void}; use tardis::web::web_resp::{TardisPage, TardisResp}; use tardis::TardisFuns; use crate::domain::todos; -#[derive(Object, FromQueryResult, Serialize, Deserialize, Debug)] +#[derive(poem_openapi::Object, sea_orm::FromQueryResult, Serialize, Deserialize, Debug)] struct TodoDetailResp { id: i32, code: String, @@ -21,7 +23,7 @@ struct TodoDetailResp { done: bool, } -#[derive(Object, Serialize, Deserialize, Debug)] +#[derive(poem_openapi::Object, Serialize, Deserialize, Debug)] struct TodoAddReq { #[oai(validator(min_length = "2", max_length = "255"))] code: TrimString, @@ -30,7 +32,7 @@ struct TodoAddReq { done: bool, } -#[derive(Object, Serialize, Deserialize, Debug)] +#[derive(poem_openapi::Object, Serialize, Deserialize, Debug)] struct TodoModifyReq { #[oai(validator(min_length = "2", max_length = "255"))] description: Option, @@ -39,7 +41,7 @@ struct TodoModifyReq { pub struct TodoApi; -#[OpenApi(prefix_path = "/todo")] +#[poem_openapi::OpenApi(prefix_path = "/todo")] impl TodoApi { // curl -X POST "http://127.0.0.1:8089/todo" \ // -H "Accept: application/json" \ diff --git a/examples/web-basic/Cargo.toml b/examples/web-basic/Cargo.toml index 8f144e5b..e5d123fc 100644 --- a/examples/web-basic/Cargo.toml +++ b/examples/web-basic/Cargo.toml @@ -3,8 +3,7 @@ name = "tardis-example-web-basic" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] tardis = { path = "../..", features = ["web-server"] } -poem-openapi = { version = "2" } - diff --git a/examples/web-basic/src/processor.rs b/examples/web-basic/src/processor.rs index 79ee22a4..23918f3e 100644 --- a/examples/web-basic/src/processor.rs +++ b/examples/web-basic/src/processor.rs @@ -1,11 +1,11 @@ use tardis::basic::error::TardisError; +use tardis::web::poem_openapi; use tardis::web::poem_openapi::param::Query; -use tardis::web::poem_openapi::OpenApi; use tardis::web::web_resp::{TardisApiResult, TardisResp}; pub struct Api; -#[OpenApi] +#[poem_openapi::OpenApi] impl Api { #[oai(path = "/hello", method = "get")] async fn index(&self, name: Query>) -> TardisApiResult { diff --git a/examples/web-client/Cargo.toml b/examples/web-client/Cargo.toml index aa652e95..9ee6650f 100644 --- a/examples/web-client/Cargo.toml +++ b/examples/web-client/Cargo.toml @@ -3,6 +3,7 @@ name = "tardis-example-web-client" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] tardis = { path = "../..", features = ["web-client"] } \ No newline at end of file diff --git a/examples/webscoket/Cargo.toml b/examples/webscoket/Cargo.toml index a331f6ac..15fe6c86 100644 --- a/examples/webscoket/Cargo.toml +++ b/examples/webscoket/Cargo.toml @@ -3,9 +3,7 @@ name = "tardis-example-websocket" version = "0.1.0" authors = ["gudaoxuri"] edition = "2021" +publish = false [dependencies] -futures-util = { version = "0.3" } tardis = { path = "../..", features = ["web-server"] } -poem = { version = "1.3" } -poem-openapi = { version = "2" } \ No newline at end of file diff --git a/examples/webscoket/src/processor.rs b/examples/webscoket/src/processor.rs index 5608f7bc..8f2c46db 100644 --- a/examples/webscoket/src/processor.rs +++ b/examples/webscoket/src/processor.rs @@ -1,5 +1,5 @@ -use futures_util::{SinkExt, StreamExt}; - +use tardis::futures_util::{SinkExt, StreamExt}; +use tardis::web::poem; use tardis::web::poem::{ handler, web::{ @@ -8,12 +8,12 @@ use tardis::web::poem::{ }, IntoResponse, }; +use tardis::web::poem_openapi; use tardis::web::poem_openapi::payload::Html; -use tardis::web::poem_openapi::OpenApi; pub struct Page; -#[OpenApi] +#[poem_openapi::OpenApi] impl Page { #[oai(path = "/p2p", method = "get")] async fn p2p(&self) -> Html<&'static str> { diff --git a/src/db.rs b/src/db.rs index a292173a..6e9b73eb 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1,4 +1,3 @@ pub use sea_orm; - pub mod domain; pub mod reldb_client; diff --git a/src/lib.rs b/src/lib.rs index bea5e1da..dcd45bce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,15 +49,18 @@ //! ```toml //! [dependencies] //! tardis = { version = "^0", features = ["web-server"] } -//! poem-openapi = { version = "^2"} //! ``` //! //! Processor Configuration //!```ignore -//! use tardis::web::poem_openapi::OpenApi; +//! use tardis::basic::error::TardisError; +//! use tardis::web::poem_openapi; +//! use tardis::web::poem_openapi::param::Query; +//! use tardis::web::web_resp::{TardisApiResult, TardisResp}; +//! //! pub struct Api; //! -//! #[OpenApi] +//! #[poem_openapi::OpenApi] //! impl Api { //! #[oai(path = "/hello", method = "get")] //! async fn index(&self, name: Query>) -> TardisResult { @@ -71,16 +74,12 @@ //! //! Startup class configuration //!```ignore -//! use tardis::basic::config::NoneConfig; -//! use tardis::basic::config::NoneConfig; -//! use tardis::basic::result::TardisResult; -//! use tardis::TardisFuns; -//! use tardis::TardisFuns; -//! //! use tardis::basic::result::TardisResult; +//! use tardis::tokio; //! use tardis::TardisFuns; +//! use crate::processor::Api; +//! mod processor; //! -//! use tardis::TardisFuns; //! #[tokio::main] //! async fn main() -> TardisResult<()> { //! // Initial configuration @@ -114,7 +113,16 @@ use std::any::Any; use std::collections::HashMap; use std::ptr::replace; +#[cfg(feature = "future")] +pub use async_stream; +#[cfg(feature = "future")] +pub use async_trait; pub use chrono; +pub use derive_more; +#[cfg(feature = "future")] +pub use futures; +#[cfg(feature = "future")] +pub use futures_util; pub use log; pub use rand; pub use regex; @@ -126,6 +134,7 @@ use serde_json::Value; pub use testcontainers; #[cfg(feature = "rt_tokio")] pub use tokio; +pub use url; use basic::error::TardisErrorWithExt; use basic::result::TardisResult;