Skip to content

Commit

Permalink
Release version 0.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
photino committed Dec 30, 2023
1 parent 540c3ce commit 099f2ca
Show file tree
Hide file tree
Showing 34 changed files with 62 additions and 95 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ which emphasizes **simplicity**, **extensibility** and **productivity**.
## Getting started

You can start with the example [`actix-app`], [`axum-app`] or [`dioxus-desktop`].
Currently, it requires rustc **nightly** to build the project.
It requires stable **rustc 75+** to build the project.

```shell
cd examples/axum-app
Expand Down
10 changes: 5 additions & 5 deletions examples/actix-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "actix-app"
description = "An example for actix-web integration."
version = "0.5.0"
version = "0.5.1"
rust-version = "1.75"
edition = "2021"
publish = false
Expand All @@ -16,18 +16,18 @@ features = ["derive"]

[dependencies.zino]
path = "../../zino"
version = "0.16.6"
version = "0.17.0"
features = ["actix"]

[dependencies.zino-core]
path = "../../zino-core"
version = "0.17.4"
version = "0.18.0"
features = ["orm-postgres", "view-minijinja"]

[dependencies.zino-derive]
path = "../../zino-derive"
version = "0.14.4"
version = "0.15.0"

[dependencies.zino-model]
path = "../../zino-model"
version = "0.14.4"
version = "0.15.0"
10 changes: 5 additions & 5 deletions examples/axum-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "axum-app"
description = "An example for axum integration."
version = "0.11.0"
version = "0.11.1"
rust-version = "1.75"
edition = "2021"
publish = false
Expand All @@ -16,12 +16,12 @@ features = ["derive"]

[dependencies.zino]
path = "../../zino"
version = "0.16.6"
version = "0.17.0"
features = ["axum"]

[dependencies.zino-core]
path = "../../zino-core"
version = "0.17.4"
version = "0.18.0"
features = [
"crypto-sm",
"orm-mysql",
Expand All @@ -32,8 +32,8 @@ features = [

[dependencies.zino-derive]
path = "../../zino-derive"
version = "0.14.4"
version = "0.15.0"

[dependencies.zino-model]
path = "../../zino-model"
version = "0.14.4"
version = "0.15.0"
10 changes: 5 additions & 5 deletions examples/dioxus-desktop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dioxus-desktop"
description = "An example for Dioxus desktop integration."
version = "0.2.0"
version = "0.2.1"
rust-version = "1.75"
edition = "2021"
publish = false
Expand All @@ -26,18 +26,18 @@ features = ["derive"]

[dependencies.zino]
path = "../../zino"
version = "0.16.6"
version = "0.17.0"
features = ["dioxus-desktop"]

[dependencies.zino-core]
path = "../../zino-core"
version = "0.17.4"
version = "0.18.0"
features = ["orm-sqlite"]

[dependencies.zino-model]
path = "../../zino-model"
version = "0.14.4"
version = "0.15.0"

[dependencies.zino-dioxus]
path = "../../zino-dioxus"
version = "0.2.0"
version = "0.2.1"
6 changes: 2 additions & 4 deletions examples/dioxus-desktop/src/service/stargazer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ pub async fn list_stargazers(per_page: u8, page: usize) -> Result<Vec<Map>, Erro
});
let mut data: Vec<Map> = App::fetch_json(resource, options.as_object()).await?;
for d in data.iter_mut() {
if let Some(user) = d.remove("user") {
if let Some(mut user) = user.into_map_opt() {
d.append(&mut user);
}
if let Some(mut user) = d.remove("user").and_then(|u| u.into_map_opt()) {
d.append(&mut user);
}
}
Ok(data)
Expand Down
4 changes: 2 additions & 2 deletions zino-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-cli"
description = "CLI tools for zino."
version = "0.1.4"
version = "0.2.0"
rust-version = "1.75"
edition = "2021"
license = "MIT"
Expand All @@ -25,4 +25,4 @@ features = ["color", "derive"]

[dependencies.zino-core]
path = "../zino-core"
version = "0.17.0"
version = "0.18.0"
4 changes: 2 additions & 2 deletions zino-cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![doc = include_str!("../README.md")]
#![doc(html_favicon_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.png")]
#![doc(html_logo_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.svg")]
#![doc(html_favicon_url = "https://zino.cc/assets/zino-logo.png")]
#![doc(html_logo_url = "https://zino.cc/assets/zino-logo.svg")]
#![forbid(unsafe_code)]

mod cli;
Expand Down
3 changes: 1 addition & 2 deletions zino-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-core"
description = "Core types and traits for zino."
version = "0.17.4"
version = "0.18.0"
rust-version = "1.75"
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -369,7 +369,6 @@ criterion = "0.5.1"
data-encoding = "2.4.0"
libsm = "0.6.0"
sm3 = "0.4.2"
sonic-rs = "0.3.0"
tinyvec = { version = "1.6.0", features = ["alloc"] }
uuid-simd = "0.8.0"

Expand Down
14 changes: 0 additions & 14 deletions zino-core/benches/json_raw_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,4 @@ pub fn bench(c: &mut criterion::Criterion) {
serde_json::to_vec(&res)
})
});
c.bench_function("sonic_serialize_json_object", |b| {
b.iter(|| {
let mut res = Map::new();
res.upsert("status_code", 200);
res.upsert("request_id", Uuid::new_v4().to_string());

let mut data = Map::new();
data.upsert("name", "alice");
data.upsert("age", 18);
data.upsert("roles", vec!["admin", "worker"]);
res.upsert("data", data);
sonic_rs::to_vec(&res)
})
});
}
2 changes: 1 addition & 1 deletion zino-core/src/auth/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl Authentication {
validation.record("signature", "should be nonempty");
} else if self
.sign_with::<H>(secret_access_key)
.is_ok_and(|token| token != signature)
.is_ok_and(|s| s != signature)
{
validation.record("signature", "invalid signature");
}
Expand Down
2 changes: 1 addition & 1 deletion zino-core/src/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ impl FromStr for DateTime {
let dt = s.parse::<chrono::DateTime<Utc>>()?;
Ok(dt.with_timezone(&Local).into())
} else {
let dt = [s, "Z"].join("").parse::<chrono::DateTime<Utc>>()?;
let dt = [s, "Z"].concat().parse::<chrono::DateTime<Utc>>()?;
Ok(dt.with_timezone(&Local).into())
}
}
Expand Down
2 changes: 1 addition & 1 deletion zino-core/src/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl NamedFile {
let suffix = ".encrypted";
let bytes = crypto::decrypt(self.as_ref(), key.as_ref())?;
if let Some(ref mut file_name) = self.file_name {
if !file_name.ends_with(suffix) {
if file_name.ends_with(suffix) {
file_name.truncate(file_name.len() - suffix.len());
}
}
Expand Down
4 changes: 2 additions & 2 deletions zino-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![doc = include_str!("../README.md")]
#![doc(html_favicon_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.png")]
#![doc(html_logo_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.svg")]
#![doc(html_favicon_url = "https://zino.cc/assets/zino-logo.png")]
#![doc(html_logo_url = "https://zino.cc/assets/zino-logo.svg")]
#![allow(async_fn_in_trait)]
#![forbid(unsafe_code)]

Expand Down
2 changes: 1 addition & 1 deletion zino-core/src/openapi/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub(crate) fn translate_model_entry(model: &mut Map, model_name: &str) {
for (key, translation) in MODEL_TRANSLATIONS.iter() {
if let Some(field) = key.strip_prefix(&model_name_prefix) {
if let Some(value) = model.get(field) {
let translated_field = [field, "translated"].join("_");
let translated_field = [field, "_translated"].concat();
let translated_value = translation
.translate(value)
.unwrap_or_else(|| value.clone());
Expand Down
8 changes: 4 additions & 4 deletions zino-core/src/orm/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ pub trait Schema: 'static + Send + Sync + ModelHooks {
for row in data {
for &col in columns {
if let Some(vec) = row.get_array(col).filter(|vec| !vec.is_empty()) {
let populated_field = [col, "populated"].join("_");
let populated_field = [col, "_populated"].concat();
let populated_values = vec
.iter()
.map(|key| {
Expand All @@ -890,7 +890,7 @@ pub trait Schema: 'static + Send + Sync + ModelHooks {
.iter()
.find_map(|(k, v)| (key == k).then_some(v));
if let Some(value) = populated_value {
let populated_field = [col, "populated"].join("_");
let populated_field = [col, "_populated"].concat();
row.upsert(populated_field, value.clone());
}
}
Expand Down Expand Up @@ -954,7 +954,7 @@ pub trait Schema: 'static + Send + Sync + ModelHooks {

for &col in columns {
if let Some(vec) = data.get_array(col).filter(|vec| !vec.is_empty()) {
let populated_field = [col, "populated"].join("_");
let populated_field = [col, "_populated"].concat();
let populated_values = vec
.iter()
.map(|key| {
Expand All @@ -974,7 +974,7 @@ pub trait Schema: 'static + Send + Sync + ModelHooks {
.iter()
.find_map(|(k, v)| (key == k).then_some(v));
if let Some(value) = populated_value {
let populated_field = [col, "populated"].join("_");
let populated_field = [col, "_populated"].concat();
data.upsert(populated_field, value.clone());
}
}
Expand Down
4 changes: 2 additions & 2 deletions zino-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-derive"
description = "Derived traits for zino."
version = "0.14.4"
version = "0.15.0"
rust-version = "1.75"
edition = "2021"
license = "MIT"
Expand All @@ -21,5 +21,5 @@ syn = "2.0.43"

[dependencies.zino-core]
path = "../zino-core"
version = "0.17.4"
version = "0.18.0"
features = ["orm"]
3 changes: 0 additions & 3 deletions zino-derive/src/decode_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ pub(super) fn parse_token_stream(input: DeriveInput) -> TokenStream {
let mut decode_model_fields = Vec::new();
for field in parser::parse_struct_fields(input.data) {
let type_name = parser::get_type_name(&field.ty);
if type_name.is_empty() {
continue;
}
if let Some(ident) = field.ident {
let name = ident.to_string();
let mut ignore = false;
Expand Down
4 changes: 2 additions & 2 deletions zino-derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![doc = include_str!("../README.md")]
#![doc(html_favicon_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.png")]
#![doc(html_logo_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.svg")]
#![doc(html_favicon_url = "https://zino.cc/assets/zino-logo.png")]
#![doc(html_logo_url = "https://zino.cc/assets/zino-logo.svg")]
#![forbid(unsafe_code)]

use proc_macro::TokenStream;
Expand Down
3 changes: 0 additions & 3 deletions zino-derive/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ pub(super) fn parse_token_stream(input: DeriveInput) -> TokenStream {
let mut field_setters = Vec::new();
for field in parser::parse_struct_fields(input.data) {
let type_name = parser::get_type_name(&field.ty);
if type_name.is_empty() {
continue;
}
if let Some(ident) = field.ident {
let name = ident.to_string();
let mut enable_setter = true;
Expand Down
3 changes: 0 additions & 3 deletions zino-derive/src/model_accessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ pub(super) fn parse_token_stream(input: DeriveInput) -> TokenStream {
let mut model_references: HashMap<String, Vec<String>> = HashMap::new();
for field in parser::parse_struct_fields(input.data) {
let type_name = parser::get_type_name(&field.ty);
if type_name.is_empty() {
continue;
}
if let Some(ident) = field.ident {
let name = ident.to_string();
let mut field_alias = None;
Expand Down
4 changes: 0 additions & 4 deletions zino-derive/src/model_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ pub(super) fn parse_token_stream(input: DeriveInput) -> TokenStream {
let mut model_mappings: HashMap<String, String> = HashMap::new();
let mut field_embeddings: HashMap<String, Vec<(String, String)>> = HashMap::new();
for field in parser::parse_struct_fields(input.data) {
let type_name = parser::get_type_name(&field.ty);
if type_name.is_empty() {
continue;
}
if let Some(ident) = field.ident {
let name = ident.to_string();
let mut correlatation_field = None;
Expand Down
3 changes: 0 additions & 3 deletions zino-derive/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ pub(super) fn parse_token_stream(input: DeriveInput) -> TokenStream {
if let Fields::Named(fields) = data.fields {
for field in fields.named.into_iter() {
let mut type_name = parser::get_type_name(&field.ty);
if type_name.is_empty() {
continue;
}
if let Some(ident) = field.ident {
let name = ident.to_string();
let mut ignore = false;
Expand Down
4 changes: 2 additions & 2 deletions zino-dioxus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-dioxus"
description = "Dioxus components for zino."
version = "0.2.0"
version = "0.2.1"
rust-version = "1.75"
edition = "2021"
license = "MIT"
Expand All @@ -21,4 +21,4 @@ smallvec = "1.11.1"

[dependencies.zino-core]
path = "../zino-core"
version = "0.17.0"
version = "0.18.0"
4 changes: 2 additions & 2 deletions zino-dioxus/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![doc = include_str!("../README.md")]
#![doc(html_favicon_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.png")]
#![doc(html_logo_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.svg")]
#![doc(html_favicon_url = "https://zino.cc/assets/zino-logo.png")]
#![doc(html_logo_url = "https://zino.cc/assets/zino-logo.svg")]
#![allow(non_snake_case)]
#![forbid(unsafe_code)]

Expand Down
4 changes: 2 additions & 2 deletions zino-extra/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-extra"
description = "Extra utilities for zino."
version = "0.1.5"
version = "0.2.0"
rust-version = "1.75"
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -41,4 +41,4 @@ optional = true

[dependencies.zino-core]
path = "../zino-core"
version = "0.17.0"
version = "0.18.0"
4 changes: 2 additions & 2 deletions zino-extra/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![doc = include_str!("../README.md")]
#![doc(html_favicon_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.png")]
#![doc(html_logo_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.svg")]
#![doc(html_favicon_url = "https://zino.cc/assets/zino-logo.png")]
#![doc(html_logo_url = "https://zino.cc/assets/zino-logo.svg")]
#![forbid(unsafe_code)]

#[cfg(feature = "cache")]
Expand Down
4 changes: 2 additions & 2 deletions zino-middleware/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc = include_str!("../README.md")]
#![doc(html_favicon_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.png")]
#![doc(html_logo_url = "https://photino.github.io/zino-docs-zh/assets/zino-logo.svg")]
#![doc(html_favicon_url = "https://zino.cc/assets/zino-logo.png")]
#![doc(html_logo_url = "https://zino.cc/assets/zino-logo.svg")]
#![forbid(unsafe_code)]
Loading

0 comments on commit 099f2ca

Please sign in to comment.