Skip to content

Commit

Permalink
Release version 0.31.0
Browse files Browse the repository at this point in the history
  • Loading branch information
photino committed Jan 8, 2025
1 parent 53ba915 commit 9a26eff
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
zino = { version = "0.30", features = ["axum"] }
zino = { version = "0.31", features = ["axum"] }
```

```rust
Expand Down
2 changes: 1 addition & 1 deletion crates/zino-auth/src/jwt_claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub fn default_verification_options() -> VerificationOptions {
static SHARED_VERIFICATION_OPTIONS: LazyLock<VerificationOptions> = LazyLock::new(|| {
if let Some(config) = State::shared().get_config("jwt") {
VerificationOptions {
accept_future: config.get_bool("accept_future").unwrap_or_default(),
accept_future: config.get_bool("accept-future").unwrap_or_default(),
required_subject: config.get_str("required-subject").map(|s| s.to_owned()),
time_tolerance: config.get_duration("time-tolerance").map(|d| d.into()),
max_validity: config.get_duration("max-validity").map(|d| d.into()),
Expand Down
2 changes: 1 addition & 1 deletion crates/zino-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ name = "zli"
path = "src/main.rs"

[dependencies]
git2 = "0.19.0"
git2 = "0.20.0"
humantime = "2.1.0"
humantime-serde = "1.1.1"
include_dir = "0.7.4"
Expand Down
2 changes: 1 addition & 1 deletion crates/zino-connector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ version = "1.0.217"
features = ["derive"]

[dependencies.serde_json]
version = "1.0.134"
version = "1.0.135"
optional = true
features = ["raw_value"]

Expand Down
10 changes: 5 additions & 5 deletions crates/zino-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ahash = "0.8.11"
apache-avro = "0.17.0"
base64 = "0.22.1"
cfg-if = "1.0"
cron = "0.13.0"
cron = "0.14.0"
csv = "1.3.1"
dirs = "5.0.1"
faster-hex = "0.10.0"
Expand All @@ -111,7 +111,7 @@ tracing = "0.1.41"
url = "2.5.4"

[dependencies.apalis]
version = "0.6.2"
version = "0.6.3"
optional = true

[dependencies.argon2]
Expand Down Expand Up @@ -173,19 +173,19 @@ version = "0.5.5"
optional = true

[dependencies.sentry]
version = "0.35.0"
version = "0.36.0"
optional = true

[dependencies.sentry-tracing]
version = "0.35.0"
version = "0.36.0"
optional = true

[dependencies.serde]
version = "1.0.217"
features = ["derive"]

[dependencies.serde_json]
version = "1.0.134"
version = "1.0.135"
features = ["raw_value"]

[dependencies.sm3]
Expand Down
12 changes: 6 additions & 6 deletions crates/zino-core/src/schedule/async_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ impl AsyncJob {
.unwrap_or_else(|err| panic!("invalid cron expression `{cron_expr}`: {err}"));
let mut context = JobContext::new();
if let Some(disabled) = config.get_bool("disable") {
context.set_status(disabled);
context.set_disabled_status(disabled);
}
if let Some(immediate) = config.get_bool("immediate") {
context.set_mode(immediate);
context.set_immediate_mode(immediate);
}
if let Some(ticks) = config
.get_bool("once")
Expand Down Expand Up @@ -98,27 +98,27 @@ impl AsyncJob {
/// Enables the flag to indicate whether the job is disabled.
#[inline]
pub fn disable(mut self, disabled: bool) -> Self {
self.context.set_status(disabled);
self.context.set_disabled_status(disabled);
self
}

/// Enables the flag to indicate whether the job is executed immediately.
#[inline]
pub fn immediate(mut self, immediate: bool) -> Self {
self.context.set_mode(immediate);
self.context.set_immediate_mode(immediate);
self
}

/// Pauses the job by setting the `disabled` flag to `true`.
#[inline]
pub fn pause(&mut self) {
self.context.set_status(true);
self.context.set_disabled_status(true);
}

/// Resumes the job by setting the `disabled` flag to `false`.
#[inline]
pub fn resume(&mut self) {
self.context.set_status(false);
self.context.set_disabled_status(false);
}

/// Executes the missed runs asynchronously.
Expand Down
8 changes: 4 additions & 4 deletions crates/zino-core/src/schedule/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ impl JobContext {
self.last_tick = Some(last_tick);
}

/// Sets the job status.
/// Sets the disabled status.
#[inline]
pub fn set_status(&mut self, disabled: bool) {
pub fn set_disabled_status(&mut self, disabled: bool) {
self.disabled = disabled;
}

/// Sets the running mode.
/// Sets the immediate mode.
#[inline]
pub fn set_mode(&mut self, immediate: bool) {
pub fn set_immediate_mode(&mut self, immediate: bool) {
self.immediate = immediate;
}

Expand Down
12 changes: 6 additions & 6 deletions crates/zino-core/src/schedule/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ impl Job {
.unwrap_or_else(|err| panic!("invalid cron expression `{cron_expr}`: {err}"));
let mut context = JobContext::new();
if let Some(disabled) = config.get_bool("disable") {
context.set_status(disabled);
context.set_disabled_status(disabled);
}
if let Some(immediate) = config.get_bool("immediate") {
context.set_mode(immediate);
context.set_immediate_mode(immediate);
}
if let Some(ticks) = config
.get_bool("once")
Expand Down Expand Up @@ -98,27 +98,27 @@ impl Job {
/// Enables the flag to indicate whether the job is disabled.
#[inline]
pub fn disable(mut self, disabled: bool) -> Self {
self.context.set_status(disabled);
self.context.set_disabled_status(disabled);
self
}

/// Enables the flag to indicate whether the job is executed immediately.
#[inline]
pub fn immediate(mut self, immediate: bool) -> Self {
self.context.set_mode(immediate);
self.context.set_immediate_mode(immediate);
self
}

/// Pauses the job by setting the `disabled` flag to `true`.
#[inline]
pub fn pause(&mut self) {
self.context.set_status(true);
self.context.set_disabled_status(true);
}

/// Resumes the job by setting the `disabled` flag to `false`.
#[inline]
pub fn resume(&mut self) {
self.context.set_status(false);
self.context.set_disabled_status(false);
}

/// Executes missed runs.
Expand Down
2 changes: 1 addition & 1 deletion crates/zino-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ version = "1.0.217"
features = ["derive"]

[dependencies.serde_json]
version = "1.0.134"
version = "1.0.135"
features = ["raw_value"]

[dependencies.tera]
Expand Down
22 changes: 14 additions & 8 deletions crates/zino-orm/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ pub trait Schema: 'static + Send + Sync + ModelHooks {
None
} else {
let name = col.name();
fields.push(name);
let field = Query::format_field(name);
fields.push(field);
Some(col.encode_value(map.get(name)))
}
})
Expand Down Expand Up @@ -513,7 +514,11 @@ pub trait Schema: 'static + Send + Sync + ModelHooks {
}

let table_name = Query::table_name_escaped::<Self>();
let fields = Self::fields().join(", ");
let fields = Self::fields()
.iter()
.map(|&field| Query::format_field(field))
.collect::<Vec<_>>()
.join(", ");
let values = values.join(", ");
let sql = format!("INSERT INTO {table_name} ({fields}) VALUES {values};");
let mut ctx = Self::before_scan(&sql).await?;
Expand Down Expand Up @@ -802,19 +807,20 @@ pub trait Schema: 'static + Send + Sync + ModelHooks {
async fn prepare_upsert(self) -> Result<QueryContext, Error> {
let map = self.into_map();
let table_name = Query::table_name_escaped::<Self>();
let fields = Self::fields();
let num_fields = fields.len();
let num_fields = Self::fields().len();
let read_only_fields = Self::read_only_fields();
let num_writable_fields = num_fields - read_only_fields.len();
let mut fields = Vec::with_capacity(num_fields);
let mut values = Vec::with_capacity(num_fields);
let mut mutations = Vec::with_capacity(num_writable_fields);
for col in Self::columns() {
let field = col.name();
let value = col.encode_value(map.get(field));
if !read_only_fields.contains(&field) {
let field = Query::format_field(field);
let name = col.name();
let field = Query::format_field(name);
let value = col.encode_value(map.get(name));
if !read_only_fields.contains(&name) {
mutations.push(format!("{field} = {value}"));
}
fields.push(field);
values.push(value);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/zino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
zino = { version = "0.30", features = ["axum"] }
zino = { version = "0.31", features = ["axum"] }
```

```rust,ignore
Expand Down

0 comments on commit 9a26eff

Please sign in to comment.