From 2c477f760b423a750dda2753270f8e581fd861cf Mon Sep 17 00:00:00 2001 From: photino Date: Wed, 5 Jul 2023 15:46:01 +0800 Subject: [PATCH] Release version 0.11.0 --- README.md | 1 + examples/actix-app/Cargo.toml | 10 +++--- examples/actix-app/config/config.dev.toml | 6 ++-- examples/actix-app/config/config.prod.toml | 6 ++-- examples/axum-app/Cargo.toml | 10 +++--- examples/axum-app/config/config.dev.toml | 6 ++-- examples/axum-app/config/config.prod.toml | 6 ++-- zino-core/Cargo.toml | 20 ++++-------- zino-core/src/connector/connector_mssql.rs | 37 ---------------------- zino-core/src/connector/data_source.rs | 14 -------- zino-core/src/connector/mod.rs | 4 --- zino-core/src/database/mysql.rs | 3 +- zino-core/src/database/postgres.rs | 3 +- zino-derive/Cargo.toml | 4 +-- zino-model/Cargo.toml | 6 ++-- zino/Cargo.toml | 6 ++-- zino/README.md | 1 + zino/src/lib.rs | 1 + 18 files changed, 42 insertions(+), 102 deletions(-) delete mode 100644 zino-core/src/connector/connector_mssql.rs diff --git a/README.md b/README.md index aa509b92..9ce25b05 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ - 🚀 Out-of-the-box features for rapid application development. - ✨ Minimal design, modular architecture and high-level abstractions. +- 🌐 Adopt an API-first approch to development with open standards. - ⚡ Embrace practical conventions to get the best performance. - 💎 Highly optimized ORM for MySQL and PostgreSQL based on [`sqlx`]. - 📅 Lightweight scheduler for sync and async cron jobs. diff --git a/examples/actix-app/Cargo.toml b/examples/actix-app/Cargo.toml index 41f4c08f..990632ab 100644 --- a/examples/actix-app/Cargo.toml +++ b/examples/actix-app/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "actix-app" description = "An example for actix-web integration." -version = "0.1.4" +version = "0.2.0" rust-version = "1.72" edition = "2021" publish = false @@ -18,12 +18,12 @@ features = ["derive"] [dependencies.zino] path = "../../zino" -version = "0.9.7" +version = "0.10.0" features = ["actix"] [dependencies.zino-core] path = "../../zino-core" -version = "0.10.7" +version = "0.11.0" features = [ "connector", "connector-arrow", @@ -33,8 +33,8 @@ features = [ [dependencies.zino-derive] path = "../../zino-derive" -version = "0.7.7" +version = "0.8.0" [dependencies.zino-model] path = "../../zino-model" -version = "0.7.7" +version = "0.8.0" diff --git a/examples/actix-app/config/config.dev.toml b/examples/actix-app/config/config.dev.toml index 35544ef3..6db1d72a 100644 --- a/examples/actix-app/config/config.dev.toml +++ b/examples/actix-app/config/config.dev.toml @@ -1,7 +1,7 @@ # --env=dev name = "data-cube" -version = "0.5.4" +version = "0.6.0" [main] host = "127.0.0.1" @@ -24,14 +24,14 @@ host = "127.0.0.1" port = 3306 database = "data_cube" username = "root" -password = "EIlijBrcrOVnlmZKALXByQRPjTxhQhrlb8NlyZOLYGs" +password = "Er/DkSLyeOsUiHXHK4hO7E8fdl1g8Qwy2Ef8mR1/4BQ" [[postgres]] host = "127.0.0.1" port = 5432 database = "data_cube" username = "postgres" -password = "rIgumT85z/q7bTPBbWCdNvruBzHpZIraUKRC1SE4xQe5vSn2" +password = "9jMzf8xZSrC3kO2okJUL9XGvFWyzh1VDJwBIJ9e78NsRfJkp" [tracing] filter = "info,sqlx=trace,zino=trace,zino_core=trace" diff --git a/examples/actix-app/config/config.prod.toml b/examples/actix-app/config/config.prod.toml index dc34914d..e52652a2 100644 --- a/examples/actix-app/config/config.prod.toml +++ b/examples/actix-app/config/config.prod.toml @@ -1,7 +1,7 @@ # --env=prod name = "data-cube" -version = "0.5.4" +version = "0.6.0" [main] host = "127.0.0.1" @@ -24,14 +24,14 @@ host = "127.0.0.1" port = 3306 database = "data_cube" username = "root" -password = "QT2MeDXD2m2MbrdDzJuSOBf94kPAEEEdMfXJSdbDny0" +password = "I/m3n8cf08ZqLsZf8Ez+mEsvbShl9CPokIzIoc8lPxM" [[postgres]] host = "127.0.0.1" port = 5432 database = "data_cube" username = "postgres" -password = "W/70bVEZ6eaXJhkn18/JrpzghRMcwqJ+ChqiqlFymcX1LDUt" +password = "Sx9x3GtJmAwwhIinkkpqwAb3exJ2+jV3CGfV7vH9C5vUvZ3p" [tracing] filter = "warn" diff --git a/examples/axum-app/Cargo.toml b/examples/axum-app/Cargo.toml index 525aeeab..13ba4ee5 100644 --- a/examples/axum-app/Cargo.toml +++ b/examples/axum-app/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "axum-app" description = "An example for axum integration." -version = "0.7.4" +version = "0.8.0" rust-version = "1.72" edition = "2021" publish = false @@ -18,12 +18,12 @@ features = ["derive"] [dependencies.zino] path = "../../zino" -version = "0.9.7" +version = "0.10.0" features = ["axum"] [dependencies.zino-core] path = "../../zino-core" -version = "0.10.7" +version = "0.11.0" features = [ "connector", "connector-arrow", @@ -33,8 +33,8 @@ features = [ [dependencies.zino-derive] path = "../../zino-derive" -version = "0.7.7" +version = "0.8.0" [dependencies.zino-model] path = "../../zino-model" -version = "0.7.7" +version = "0.8.0" diff --git a/examples/axum-app/config/config.dev.toml b/examples/axum-app/config/config.dev.toml index 06b41535..de87a0e9 100644 --- a/examples/axum-app/config/config.dev.toml +++ b/examples/axum-app/config/config.dev.toml @@ -1,7 +1,7 @@ # --env=dev name = "data-cube" -version = "0.5.4" +version = "0.6.0" [main] host = "127.0.0.1" @@ -24,14 +24,14 @@ host = "127.0.0.1" port = 3306 database = "data_cube" username = "root" -password = "QIyThisBQvkLrupu/FZn0HpkVe7IvRboPjTQu21V89I" +password = "QWi65/uOdFy745k4/vT5NyNsUKHppu7ccc+9oaF3lHs" [[postgres]] host = "127.0.0.1" port = 5432 database = "data_cube" username = "postgres" -password = "W2rHYCNbBmJ3WBsFPa65S5VAoQTONLzl+r0rAhxEr9pv59Pv" +password = "D2m/CORXdT/zHw/pD3lWF2HejeGGTnhvkgfMV7biZctNAKlx" [tracing] filter = "info,sqlx=trace,zino=trace,zino_core=trace" diff --git a/examples/axum-app/config/config.prod.toml b/examples/axum-app/config/config.prod.toml index 13b9bb2b..e93f74dd 100644 --- a/examples/axum-app/config/config.prod.toml +++ b/examples/axum-app/config/config.prod.toml @@ -1,7 +1,7 @@ # --env=prod name = "data-cube" -version = "0.5.4" +version = "0.6.0" [main] host = "127.0.0.1" @@ -24,14 +24,14 @@ host = "127.0.0.1" port = 3306 database = "data_cube" username = "root" -password = "vyis/yqE/tFzZSCz+Ew0M0P6vkyzjEXRtZcOWOCfmWA" +password = "2M/J9HZJn6OE4PF0W4Dtz7X/wZ8L/hBxfAMqUBKzuM8" [[postgres]] host = "127.0.0.1" port = 5432 database = "data_cube" username = "postgres" -password = "Sh08dkU/IW7c9dND+zDih21gDDwiCTVFCVNqGNpCjgryB9Cq" +password = "UamCNm91h3rQNcJkcJyw4YmtI0lH3sLoGhkHO9Onzm2PGnc2" [tracing] filter = "warn" diff --git a/zino-core/Cargo.toml b/zino-core/Cargo.toml index 72acd522..c7261f78 100644 --- a/zino-core/Cargo.toml +++ b/zino-core/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zino-core" description = "Core types and traits for zino." -version = "0.10.7" +version = "0.11.0" rust-version = "1.72" edition = "2021" license = "MIT" @@ -38,7 +38,6 @@ all-connectors = [ "connector", "connector-arrow", "connector-http", - "connector-mssql", "connector-mysql", "connector-postgres", "connector-sqlite", @@ -50,7 +49,6 @@ all-chatbots = ["chatbot", "chatbot-openai"] connector = ["connector-http"] connector-arrow = ["dep:datafusion", "connector"] connector-http = ["connector"] -connector-mssql = ["connector", "sqlx", "sqlx/mssql"] connector-mysql = ["connector", "sqlx", "sqlx/mysql"] connector-postgres = ["connector", "sqlx", "sqlx/postgres"] connector-sqlite = ["connector", "sqlx", "sqlx/sqlite"] @@ -66,9 +64,8 @@ full = [ orm = ["sqlx", "sqlx/postgres"] orm-mysql = ["orm", "sqlx/mysql"] orm-postgres = ["orm", "sqlx/postgres"] -runtime-actix = ["sqlx/runtime-actix-rustls"] -runtime-async-std = ["sqlx/runtime-async-std-rustls"] -runtime-tokio = ["sqlx/runtime-tokio-rustls"] +runtime-async-std = ["sqlx/runtime-async-std"] +runtime-tokio = ["sqlx/runtime-tokio"] view = ["dep:minijinja"] view-tera = ["view", "dep:tera"] view-minijinja = ["view", "dep:minijinja"] @@ -153,10 +150,6 @@ features = [ "stream", ] -[dependencies.rust_decimal] -version = "1.30.0" -features = ["serde-float"] - [dependencies.serde] version = "1.0.164" features = ["derive"] @@ -166,12 +159,13 @@ version = "1.0.99" features = ["raw_value"] [dependencies.sqlx] -version = "0.6.3" +version = "0.7.0" optional = true features = [ + "bigdecimal", "chrono", - "decimal", - "json", + "rust_decimal", + "tls-rustls", "uuid", ] diff --git a/zino-core/src/connector/connector_mssql.rs b/zino-core/src/connector/connector_mssql.rs deleted file mode 100644 index b1dbd260..00000000 --- a/zino-core/src/connector/connector_mssql.rs +++ /dev/null @@ -1,37 +0,0 @@ -use super::{Connector, DataSource, DataSourceConnector::Mssql}; -use crate::{error::Error, extension::TomlTableExt, state::State}; -use sqlx::mssql::{MssqlPool, MssqlPoolOptions}; -use std::time::Duration; -use toml::Table; - -impl Connector for MssqlPool { - fn try_new_data_source(config: &Table) -> Result { - let name = config.get_str("name").unwrap_or("mssql"); - let database = config.get_str("database").unwrap_or("master"); - let authority = State::format_authority(config, Some(1433)); - let dsn = format!("mssql://{authority}/{database}"); - - let max_connections = config.get_u32("max-connections").unwrap_or(16); - let min_connections = config.get_u32("min-connections").unwrap_or(2); - let max_lifetime = config - .get_duration("max-lifetime") - .unwrap_or_else(|| Duration::from_secs(60 * 60)); - let idle_timeout = config - .get_duration("idle-timeout") - .unwrap_or_else(|| Duration::from_secs(10 * 60)); - let acquire_timeout = config - .get_duration("acquire-timeout") - .unwrap_or_else(|| Duration::from_secs(30)); - let pool_options = MssqlPoolOptions::new() - .max_connections(max_connections) - .min_connections(min_connections) - .max_lifetime(max_lifetime) - .idle_timeout(idle_timeout) - .acquire_timeout(acquire_timeout); - let pool = pool_options.connect_lazy(&dsn)?; - let data_source = DataSource::new("mssql", None, name, database, Mssql(pool)); - Ok(data_source) - } - - super::sqlx_common::impl_sqlx_connector!(MssqlPool); -} diff --git a/zino-core/src/connector/data_source.rs b/zino-core/src/connector/data_source.rs index fe31fa53..49724554 100644 --- a/zino-core/src/connector/data_source.rs +++ b/zino-core/src/connector/data_source.rs @@ -7,8 +7,6 @@ use toml::Table; use super::ArrowConnector; #[cfg(feature = "connector-http")] use super::HttpConnector; -#[cfg(feature = "connector-mssql")] -use sqlx::mssql::MssqlPool; #[cfg(feature = "connector-mysql")] use sqlx::mysql::MySqlPool; #[cfg(feature = "connector-postgres")] @@ -25,9 +23,6 @@ pub(super) enum DataSourceConnector { /// HTTP #[cfg(feature = "connector-http")] Http(HttpConnector), - /// MSSQL - #[cfg(feature = "connector-mssql")] - Mssql(MssqlPool), /// MySQL #[cfg(feature = "connector-mysql")] MySql(MySqlPool), @@ -89,8 +84,6 @@ impl DataSource { "arrow" => ArrowConnector::try_new_data_source(config)?, #[cfg(feature = "connector-http")] "http" => HttpConnector::try_new_data_source(config)?, - #[cfg(feature = "connector-mssql")] - "mssql" => MssqlPool::try_new_data_source(config)?, #[cfg(feature = "connector-mysql")] "mysql" => MySqlPool::try_new_data_source(config)?, #[cfg(feature = "connector-postgres")] @@ -162,7 +155,6 @@ impl Connector for DataSource { let protocol = match source_type { "arrow" => "arrow", "http" | "rest" | "graphql" => "http", - "mssql" => "mssql", "mysql" | "ceresdb" | "databend" | "mariadb" | "tidb" => "mysql", "postgres" | "citus" | "greptimedb" | "highgo" | "hologres" | "opengauss" | "postgis" | "timescaledb" => "postgres", @@ -185,8 +177,6 @@ impl Connector for DataSource { Arrow(connector) => connector.execute(query, params).await, #[cfg(feature = "connector-http")] Http(connector) => connector.execute(query, params).await, - #[cfg(feature = "connector-mssql")] - Mssql(pool) => pool.execute(query, params).await, #[cfg(feature = "connector-mysql")] MySql(pool) => pool.execute(query, params).await, #[cfg(feature = "connector-postgres")] @@ -202,8 +192,6 @@ impl Connector for DataSource { Arrow(connector) => connector.query(query, params).await, #[cfg(feature = "connector-http")] Http(connector) => connector.query(query, params).await, - #[cfg(feature = "connector-mssql")] - Mssql(pool) => pool.query(query, params).await, #[cfg(feature = "connector-mysql")] MySql(pool) => pool.query(query, params).await, #[cfg(feature = "connector-postgres")] @@ -219,8 +207,6 @@ impl Connector for DataSource { Arrow(connector) => connector.query_one(query, params).await, #[cfg(feature = "connector-http")] Http(connector) => connector.query_one(query, params).await, - #[cfg(feature = "connector-mssql")] - Mssql(pool) => pool.query_one(query, params).await, #[cfg(feature = "connector-mysql")] MySql(pool) => pool.query_one(query, params).await, #[cfg(feature = "connector-postgres")] diff --git a/zino-core/src/connector/mod.rs b/zino-core/src/connector/mod.rs index 3c62b435..21801fe5 100644 --- a/zino-core/src/connector/mod.rs +++ b/zino-core/src/connector/mod.rs @@ -14,7 +14,6 @@ //! | `hologres` | Aliyun Hologres | `connector-postgres` | //! | `http` | HTTP services | `connector-http` | //! | `mariadb` | MariaDB | `connector-mysql` | -//! | `mssql` | MSSQL (SQL Server) | `connector-mssql` | //! | `mysql` | MySQL | `connector-mysql` | //! | `opengauss` | openGauss | `connector-postgres` | //! | `postgis` | PostGIS | `connector-postgres` | @@ -37,8 +36,6 @@ mod data_source; mod connector_arrow; #[cfg(feature = "connector-http")] mod connector_http; -#[cfg(feature = "connector-mssql")] -mod connector_mssql; #[cfg(feature = "connector-mysql")] mod connector_mysql; #[cfg(feature = "connector-postgres")] @@ -47,7 +44,6 @@ mod connector_postgres; mod connector_sqlite; #[cfg(any( - feature = "connector-mssql", feature = "connector-mysql", feature = "connector-postgres", feature = "connector-sqlite" diff --git a/zino-core/src/database/mysql.rs b/zino-core/src/database/mysql.rs index e4889f24..f461df9d 100644 --- a/zino-core/src/database/mysql.rs +++ b/zino-core/src/database/mysql.rs @@ -7,8 +7,7 @@ use crate::{ AvroValue, JsonValue, Map, Record, SharedString, Uuid, }; use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; -use rust_decimal::Decimal; -use sqlx::{Column as _, Row, TypeInfo, ValueRef}; +use sqlx::{types::Decimal, Column as _, Row, TypeInfo, ValueRef}; use std::borrow::Cow; impl<'c> EncodeColumn for Column<'c> { diff --git a/zino-core/src/database/postgres.rs b/zino-core/src/database/postgres.rs index a6d7d611..df614e73 100644 --- a/zino-core/src/database/postgres.rs +++ b/zino-core/src/database/postgres.rs @@ -7,8 +7,7 @@ use crate::{ AvroValue, JsonValue, Map, Record, SharedString, Uuid, }; use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; -use rust_decimal::Decimal; -use sqlx::{Column as _, Row, TypeInfo, ValueRef}; +use sqlx::{types::Decimal, Column as _, Row, TypeInfo, ValueRef}; use std::borrow::Cow; impl<'c> EncodeColumn for Column<'c> { diff --git a/zino-derive/Cargo.toml b/zino-derive/Cargo.toml index 081a14c8..b8d65a16 100644 --- a/zino-derive/Cargo.toml +++ b/zino-derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zino-derive" description = "Derived traits for zino." -version = "0.7.7" +version = "0.8.0" rust-version = "1.72" edition = "2021" license = "MIT" @@ -21,5 +21,5 @@ syn = "2.0.23" [dependencies.zino-core] path = "../zino-core" -version = "0.10.7" +version = "0.11.0" features = ["orm"] diff --git a/zino-model/Cargo.toml b/zino-model/Cargo.toml index 2943e895..6bc37d0e 100644 --- a/zino-model/Cargo.toml +++ b/zino-model/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zino-model" description = "Model types for zino." -version = "0.7.7" +version = "0.8.0" rust-version = "1.72" edition = "2021" license = "MIT" @@ -37,9 +37,9 @@ features = ["derive"] [dependencies.zino-core] path = "../zino-core" -version = "0.10.7" +version = "0.11.0" features = ["orm"] [dependencies.zino-derive] path = "../zino-derive" -version = "0.7.7" +version = "0.8.0" diff --git a/zino/Cargo.toml b/zino/Cargo.toml index 67a1a77e..0b61289a 100644 --- a/zino/Cargo.toml +++ b/zino/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zino" description = "Full-featured web application framework for Rust." -version = "0.9.7" +version = "0.10.0" rust-version = "1.72" edition = "2021" license = "MIT" @@ -22,7 +22,7 @@ actix = [ "dep:actix-web", "dep:tracing-actix-web", "utoipa-swagger-ui/actix-web", - "zino-core/runtime-actix", + "zino-core/runtime-tokio", ] axum = [ "dep:axum", @@ -124,4 +124,4 @@ features = [ [dependencies.zino-core] path = "../zino-core" -version = "0.10.7" +version = "0.11.0" diff --git a/zino/README.md b/zino/README.md index a274425b..726ea15b 100644 --- a/zino/README.md +++ b/zino/README.md @@ -7,6 +7,7 @@ - 🚀 Out-of-the-box features for rapid application development. - ✨ Minimal design, modular architecture and high-level abstractions. +- 🌐 Adopt an API-first approch to development with open standards. - ⚡ Embrace practical conventions to get the best performance. - 💎 Highly optimized ORM for MySQL and PostgreSQL based on [`sqlx`]. - 📅 Lightweight scheduler for sync and async cron jobs. diff --git a/zino/src/lib.rs b/zino/src/lib.rs index 30c885ba..732463cf 100644 --- a/zino/src/lib.rs +++ b/zino/src/lib.rs @@ -13,6 +13,7 @@ //! //! - 🚀 Out-of-the-box features for rapid application development. //! - ✨ Minimal design, modular architecture and high-level abstractions. +//! - 🌐 Adopt an API-first approch to development with open standards. //! - ⚡ Embrace practical conventions to get the best performance. //! - 💎 Highly optimized ORM for MySQL and PostgreSQL based on [`sqlx`]. //! - 📅 Lightweight scheduler for sync and async cron jobs.