split into async and blocking features (#36)

* split into async and blocking features

* update Cargo.toml file

* fix example
This commit is contained in:
Ayrat Badykov 2022-07-20 19:08:02 +03:00 committed by GitHub
parent d3805cd562
commit d585bde870
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 54 additions and 29 deletions

View file

@ -11,19 +11,53 @@ rust-version = "1.62"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
blocking = ["diesel", "diesel-derive-enum", "dotenv"]
asynk = ["bb8-postgres", "postgres-types", "tokio", "async-trait", "typed-builder"]
[dependencies]
diesel = { version = "1.4", features = ["postgres", "serde_json", "chrono", "uuidv07", "r2d2"] }
diesel-derive-enum = { version = "1", features = ["postgres"] }
dotenv = "0.15"
uuid = { version = "0.8", features = ["v4"] }
chrono = "0.4"
serde_json = "1"
typetag = "0.2"
log = "0.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "1.0"
bb8-postgres = {version = "0.8", features = ["with-serde_json-1" , "with-uuid-0_8" , "with-chrono-0_4" ]}
postgres-types = { version = "0.X.X", features = ["derive"] }
tokio = { version = "1.20", features = ["full"] }
async-trait = "0.1"
typed-builder = "0.10"
typetag = "0.2"
uuid = { version = "0.8", features = ["v4"] }
[dependencies.diesel]
version = "1.4"
features = ["postgres", "serde_json", "chrono", "uuidv07", "r2d2"]
optional = true
[dependencies.diesel-derive-enum]
version = "1"
features = ["postgres"]
optional = true
[dependencies.dotenv]
version = "0.15"
optional = true
[dependencies.bb8-postgres]
version = "0.8"
features = ["with-serde_json-1" , "with-uuid-0_8" , "with-chrono-0_4"]
optional = true
[dependencies.postgres-types]
version = "0.X.X"
features = ["derive"]
optional = true
[dependencies.tokio]
version = "1.20"
features = ["full"]
optional = true
[dependencies.async-trait]
version = "0.1"
optional = true
[dependencies.typed-builder]
version = "0.10"
optional = true

View file

@ -6,7 +6,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
fang = { path = "../../" }
fang = { path = "../../" , features = ["blocking"]}
serde = { version = "1.0", features = ["derive"] }
signal-hook = "0.3.10"
dotenv = "0.15.0"

View file

@ -1,29 +1,20 @@
// #![allow(clippy::nonstandard_macro_braces)]
#![allow(clippy::extra_unused_lifetimes)]
// pub mod error;
// pub mod executor;
// pub mod queue;
// pub mod scheduler;
// pub mod schema;
// pub mod worker_pool;
// pub use error::FangError;
// pub use executor::*;
// pub use queue::*;
// pub use scheduler::*;
// pub use schema::*;
// pub use worker_pool::*;
#[macro_use]
#[cfg(feature = "blocking")]
extern crate diesel;
#[doc(hidden)]
#[cfg(feature = "blocking")]
pub use diesel::pg::PgConnection;
#[doc(hidden)]
pub use typetag;
pub mod sync;
pub use sync::*;
#[cfg(feature = "blocking")]
pub mod blocking;
#[cfg(feature = "blocking")]
pub use blocking::*;
#[cfg(feature = "asynk")]
pub mod asynk;