Skip to content

Commit

Permalink
Release version 0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
photino committed Aug 9, 2023
1 parent c46ebf4 commit 208591d
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 54 deletions.
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.2.1"
version = "0.2.2"
rust-version = "1.72"
edition = "2021"
publish = false
Expand All @@ -18,12 +18,12 @@ features = ["derive"]

[dependencies.zino]
path = "../../zino"
version = "0.10.5"
version = "0.11.0"
features = ["actix", "export-pdf"]

[dependencies.zino-core]
path = "../../zino-core"
version = "0.11.5"
version = "0.12.0"
features = [
"connector",
"connector-arrow",
Expand All @@ -33,8 +33,8 @@ features = [

[dependencies.zino-derive]
path = "../../zino-derive"
version = "0.8.5"
version = "0.9.0"

[dependencies.zino-model]
path = "../../zino-model"
version = "0.8.5"
version = "0.9.0"
4 changes: 2 additions & 2 deletions examples/actix-app/config/config.dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ host = "127.0.0.1"
port = 3306
database = "data_cube"
username = "root"
password = "Is/w8eraMJT9XPR/ZQxnnU4EIw9nvEJ2kdfVqCgUlVw"
password = "ojOAhiNzR6evuSA7tEB0yQ+XZFAGsRZwxnRnaBWr+o0"

[[postgres]]
host = "127.0.0.1"
port = 5432
database = "data_cube"
username = "postgres"
password = "Gy4aG3LjEKR7QarmVrU1isCW4gTNqYGXrrKYh9cFYACxnx1v"
password = "iPC3bcPjfD8t+4l4d5KVl9JL4TEte4WS4TQkvhZPmRE1IuRU"

[tracing]
filter = "info,sqlx=info,zino=trace,zino_core=trace"
Expand Down
4 changes: 2 additions & 2 deletions examples/actix-app/config/config.prod.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ host = "127.0.0.1"
port = 3306
database = "data_cube"
username = "root"
password = "s0/lciv/Bfm7hI6R65CRDI3VuRwf4oICoOVN4sZlezY"
password = "7jHbEYq9pNcYWOkm/IciGEYADrQ/SVXbHidyml4nNWk"

[[postgres]]
host = "127.0.0.1"
port = 5432
database = "data_cube"
username = "postgres"
password = "MEckyLpuIErrOkWK/YUqIAUTGA+MDcKET4lIZYmsHZo7wky8"
password = "7ucIHbdEKszPaiijqP9n+RzWLK8vI9+4JkcA1WSrpb+eTe6Y"

[tracing]
filter = "warn"
Expand Down
1 change: 1 addition & 0 deletions examples/actix-app/src/domain/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

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.8.1"
version = "0.8.2"
rust-version = "1.72"
edition = "2021"
publish = false
Expand All @@ -18,12 +18,12 @@ features = ["derive"]

[dependencies.zino]
path = "../../zino"
version = "0.10.5"
version = "0.11.0"
features = ["axum", "export-pdf"]

[dependencies.zino-core]
path = "../../zino-core"
version = "0.11.5"
version = "0.12.0"
features = [
"connector",
"connector-arrow",
Expand All @@ -33,8 +33,8 @@ features = [

[dependencies.zino-derive]
path = "../../zino-derive"
version = "0.8.5"
version = "0.9.0"

[dependencies.zino-model]
path = "../../zino-model"
version = "0.8.5"
version = "0.9.0"
4 changes: 2 additions & 2 deletions examples/axum-app/config/config.dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ host = "127.0.0.1"
port = 3306
database = "data_cube"
username = "root"
password = "v/MSg5oWYN43BlvPGEToDhGBrpZPwkFYLoM+EqrMJuk"
password = "0iLeU5EOoJK3ZAF/s25e6KJPikVmRL3DTaYvSvF10gw"

[[postgres]]
host = "127.0.0.1"
port = 5432
database = "data_cube"
username = "postgres"
password = "2xiKJvFWFNxInNyVqiW2ceeCVaLw2EEnvOmyo6sEAOsGCGvr"
password = "oAMk4OLvYhScFXT1R5NIIGZBJrjShQuedqavJW7fYfi+TQ/j"

[tracing]
filter = "info,sqlx=info,zino=trace,zino_core=trace"
Expand Down
4 changes: 2 additions & 2 deletions examples/axum-app/config/config.prod.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ host = "127.0.0.1"
port = 3306
database = "data_cube"
username = "root"
password = "WoWhU03uWHCDGXdY/v49Q9XP/xTe/2ydXG6oh4QiVxY"
password = "yErfJ4wTEiIO3qy77QAzubyrVcKZB8bHTzUuI/hx78E"

[[postgres]]
host = "127.0.0.1"
port = 5432
database = "data_cube"
username = "postgres"
password = "xy6IsBbwqK0FzrxdRvrxi0F+NC1YqlnQRUj78aqxrV576D2b"
password = "BAydY/V1w/IESDcoUygvNBQj6l3euOl5QnvimHtTyAbA6NJV"

[tracing]
filter = "warn"
Expand Down
1 change: 1 addition & 0 deletions examples/axum-app/src/domain/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 2 additions & 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.11.5"
version = "0.12.0"
rust-version = "1.72"
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -103,7 +103,7 @@ mime_guess = "2.0.4"
multer = "2.1.0"
parking_lot = "0.12.1"
rand = "0.8.5"
regex = "1.9.1"
regex = "1.9.3"
reqwest-middleware = "0.2.2"
reqwest-retry = "0.2.2"
reqwest-tracing = "0.4.5"
Expand Down
11 changes: 11 additions & 0 deletions zino-core/src/model/mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ impl MutationBuilder {
}
}

/// Sets the value of the field.
#[inline]
pub fn set<S, T>(&mut self, field: S, value: T) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue>,
{
self.updates.upsert(field, value);
self
}

/// Constructs an instance of `Mutation`.
#[inline]
pub fn build(self) -> Mutation {
Expand Down
66 changes: 40 additions & 26 deletions zino-core/src/model/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,15 @@ impl Query {
if self.fields.is_empty() {
self.fields = fields.iter().map(|&key| key.to_owned()).collect::<Vec<_>>();
} else {
self.fields.retain(|field| {
fields
.iter()
.any(|key| field == key || field.starts_with(&format!("{key}:")))
})
self.fields.retain(|field| fields.contains(&field.as_str()))
}
}

/// Removes the projection fields in the deny list.
#[inline]
pub fn deny_fields(&mut self, fields: &[&str]) {
self.fields.retain(|field| {
!fields
.iter()
.any(|key| field == key || field.starts_with(&format!("{key}:")))
})
self.fields
.retain(|field| !fields.contains(&field.as_str()))
}

/// Adds a key-value pair to the query filters.
Expand Down Expand Up @@ -301,125 +294,146 @@ impl QueryBuilder {
}
}

/// Adds a field to the projection.
#[inline]
pub fn field<S: Into<String>>(&mut self, field: S) -> &mut Self {
let field = field.into();
if !self.fields.contains(&field) {
self.fields.push(field);
}
self
}

/// Adds a filter with the condition for equal parts.
#[inline]
pub fn and_eq<S, T>(&mut self, field: S, value: T)
pub fn and_eq<S, T>(&mut self, field: S, value: T) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue>,
{
self.filters.upsert(field.into(), value);
self
}

/// Adds a filter with the condition for non-equal parts.
#[inline]
pub fn and_ne<S, T>(&mut self, field: S, value: T)
pub fn and_ne<S, T>(&mut self, field: S, value: T) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue>,
{
self.filters
.upsert(field.into(), Map::from_entry("$ne", value));
self
}

/// Adds a filter with the condition for a field less than the value.
#[inline]
pub fn and_lt<S, T>(&mut self, field: S, value: T)
pub fn and_lt<S, T>(&mut self, field: S, value: T) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue>,
{
self.filters
.upsert(field.into(), Map::from_entry("$lt", value));
self
}

/// Adds a filter with the condition for a field not greater than the value.
#[inline]
pub fn and_le<S, T>(&mut self, field: S, value: T)
pub fn and_le<S, T>(&mut self, field: S, value: T) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue>,
{
self.filters
.upsert(field.into(), Map::from_entry("$le", value));
self
}

/// Adds a filter with the condition for a field greater than the value.
#[inline]
pub fn and_gt<S, T>(&mut self, field: S, value: T)
pub fn and_gt<S, T>(&mut self, field: S, value: T) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue>,
{
self.filters
.upsert(field.into(), Map::from_entry("$lt", value));
self
}

/// Adds a filter with the condition for a field not less than the value.
#[inline]
pub fn and_ge<S, T>(&mut self, field: S, value: T)
pub fn and_ge<S, T>(&mut self, field: S, value: T) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue>,
{
self.filters
.upsert(field.into(), Map::from_entry("$ge", value));
self
}

/// Adds a filter with the condition for a field whose value is in the list.
#[inline]
pub fn and_in<S, T>(&mut self, field: S, list: &[T])
pub fn and_in<S, T>(&mut self, field: S, list: &[T]) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue> + Clone,
{
self.filters
.upsert(field.into(), Map::from_entry("$in", list));
self
}

/// Adds a filter with the condition for a field whose value is not in the list.
#[inline]
pub fn and_not_in<S, T>(&mut self, field: S, list: &[T])
pub fn and_not_in<S, T>(&mut self, field: S, list: &[T]) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue> + Clone,
{
self.filters
.upsert(field.into(), Map::from_entry("$nin", list));
self
}

/// Adds a filter with the condition for a field whose value is within a given range.
pub fn and_between<S, T>(&mut self, field: S, min: T, max: T)
pub fn and_between<S, T>(&mut self, field: S, min: T, max: T) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue>,
{
self.filters.upsert(
field.into(),
Map::from_entry("$between", vec![min.into(), max.into()]),
);
let values = vec![min.into(), max.into()];
self.filters
.upsert(field.into(), Map::from_entry("$between", values));
self
}

/// Adds a filter with the condition to search for a specified pattern in a column.
pub fn and_like<S, T>(&mut self, field: S, value: T)
pub fn and_like<S, T>(&mut self, field: S, value: T) -> &mut Self
where
S: Into<String>,
T: Into<JsonValue>,
{
self.filters
.upsert(field.into(), Map::from_entry("$like", value));
self
}

/// Adds a filter which groups rows that have the same values into summary rows.
#[inline]
pub fn group_by<T: Into<JsonValue>>(&mut self, fields: T) {
pub fn group_by<T: Into<JsonValue>>(&mut self, fields: T) -> &mut Self {
self.filters.upsert("$group", fields);
self
}

/// Adds a filter which can be used with aggregate functions.
#[inline]
pub fn having<T: Into<JsonValue>>(&mut self, selection: T) {
pub fn having<T: Into<JsonValue>>(&mut self, selection: T) -> &mut Self {
self.filters.upsert("$having", selection);
self
}

/// Adds a sort with the specific order.
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.8.5"
version = "0.9.0"
rust-version = "1.72"
edition = "2021"
license = "MIT"
Expand All @@ -21,5 +21,5 @@ syn = "2.0.28"

[dependencies.zino-core]
path = "../zino-core"
version = "0.11.5"
version = "0.12.0"
features = ["orm"]
Loading

0 comments on commit 208591d

Please sign in to comment.