Update time
crate to 0.3.35 version
This commit is contained in:
parent
6f9c5b1034
commit
6ffbb66719
2 changed files with 14 additions and 13 deletions
juniper
|
@ -59,7 +59,7 @@ serde = { version = "1.0.122", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.18", features = ["std"], default-features = false, optional = true }
|
serde_json = { version = "1.0.18", features = ["std"], default-features = false, optional = true }
|
||||||
smartstring = "1.0"
|
smartstring = "1.0"
|
||||||
static_assertions = "1.1"
|
static_assertions = "1.1"
|
||||||
time = { version = "0.3", features = ["formatting", "macros", "parsing"], optional = true }
|
time = { version = "0.3.35", features = ["formatting", "macros", "parsing"], optional = true }
|
||||||
url = { version = "2.0", optional = true }
|
url = { version = "2.0", optional = true }
|
||||||
uuid = { version = "1.3", default-features = false, optional = true }
|
uuid = { version = "1.3", default-features = false, optional = true }
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
//! [s5]: https://graphql-scalars.dev/docs/scalars/utc-offset
|
//! [s5]: https://graphql-scalars.dev/docs/scalars/utc-offset
|
||||||
|
|
||||||
use time::{
|
use time::{
|
||||||
format_description::{well_known::Rfc3339, FormatItem},
|
format_description::{well_known::Rfc3339, BorrowedFormatItem},
|
||||||
macros::format_description,
|
macros::format_description,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,12 +52,12 @@ mod date {
|
||||||
/// Format of a [`Date` scalar][1].
|
/// Format of a [`Date` scalar][1].
|
||||||
///
|
///
|
||||||
/// [1]: https://graphql-scalars.dev/docs/scalars/date
|
/// [1]: https://graphql-scalars.dev/docs/scalars/date
|
||||||
const FORMAT: &[FormatItem<'_>] = format_description!("[year]-[month]-[day]");
|
const FORMAT: &[BorrowedFormatItem<'_>] = format_description!("[year]-[month]-[day]");
|
||||||
|
|
||||||
pub(super) fn to_output<S: ScalarValue>(v: &Date) -> Value<S> {
|
pub(super) fn to_output<S: ScalarValue>(v: &Date) -> Value<S> {
|
||||||
Value::scalar(
|
Value::scalar(
|
||||||
v.format(FORMAT)
|
v.format(FORMAT)
|
||||||
.unwrap_or_else(|e| panic!("Failed to format `Date`: {e}")),
|
.unwrap_or_else(|e| panic!("failed to format `Date`: {e}")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,18 +89,19 @@ mod local_time {
|
||||||
/// Full format of a [`LocalTime` scalar][1].
|
/// Full format of a [`LocalTime` scalar][1].
|
||||||
///
|
///
|
||||||
/// [1]: https://graphql-scalars.dev/docs/scalars/local-time
|
/// [1]: https://graphql-scalars.dev/docs/scalars/local-time
|
||||||
const FORMAT: &[FormatItem<'_>] =
|
const FORMAT: &[BorrowedFormatItem<'_>] =
|
||||||
format_description!("[hour]:[minute]:[second].[subsecond digits:3]");
|
format_description!("[hour]:[minute]:[second].[subsecond digits:3]");
|
||||||
|
|
||||||
/// Format of a [`LocalTime` scalar][1] without milliseconds.
|
/// Format of a [`LocalTime` scalar][1] without milliseconds.
|
||||||
///
|
///
|
||||||
/// [1]: https://graphql-scalars.dev/docs/scalars/local-time
|
/// [1]: https://graphql-scalars.dev/docs/scalars/local-time
|
||||||
const FORMAT_NO_MILLIS: &[FormatItem<'_>] = format_description!("[hour]:[minute]:[second]");
|
const FORMAT_NO_MILLIS: &[BorrowedFormatItem<'_>] =
|
||||||
|
format_description!("[hour]:[minute]:[second]");
|
||||||
|
|
||||||
/// Format of a [`LocalTime` scalar][1] without seconds.
|
/// Format of a [`LocalTime` scalar][1] without seconds.
|
||||||
///
|
///
|
||||||
/// [1]: https://graphql-scalars.dev/docs/scalars/local-time
|
/// [1]: https://graphql-scalars.dev/docs/scalars/local-time
|
||||||
const FORMAT_NO_SECS: &[FormatItem<'_>] = format_description!("[hour]:[minute]");
|
const FORMAT_NO_SECS: &[BorrowedFormatItem<'_>] = format_description!("[hour]:[minute]");
|
||||||
|
|
||||||
pub(super) fn to_output<S: ScalarValue>(v: &LocalTime) -> Value<S> {
|
pub(super) fn to_output<S: ScalarValue>(v: &LocalTime) -> Value<S> {
|
||||||
Value::scalar(
|
Value::scalar(
|
||||||
|
@ -109,7 +110,7 @@ mod local_time {
|
||||||
} else {
|
} else {
|
||||||
v.format(FORMAT)
|
v.format(FORMAT)
|
||||||
}
|
}
|
||||||
.unwrap_or_else(|e| panic!("Failed to format `LocalTime`: {e}")),
|
.unwrap_or_else(|e| panic!("failed to format `LocalTime`: {e}")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,13 +141,13 @@ mod local_date_time {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
/// Format of a [`LocalDateTime`] scalar.
|
/// Format of a [`LocalDateTime`] scalar.
|
||||||
const FORMAT: &[FormatItem<'_>] =
|
const FORMAT: &[BorrowedFormatItem<'_>] =
|
||||||
format_description!("[year]-[month]-[day] [hour]:[minute]:[second]");
|
format_description!("[year]-[month]-[day] [hour]:[minute]:[second]");
|
||||||
|
|
||||||
pub(super) fn to_output<S: ScalarValue>(v: &LocalDateTime) -> Value<S> {
|
pub(super) fn to_output<S: ScalarValue>(v: &LocalDateTime) -> Value<S> {
|
||||||
Value::scalar(
|
Value::scalar(
|
||||||
v.format(FORMAT)
|
v.format(FORMAT)
|
||||||
.unwrap_or_else(|e| panic!("Failed to format `LocalDateTime`: {e}")),
|
.unwrap_or_else(|e| panic!("failed to format `LocalDateTime`: {e}")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ mod date_time {
|
||||||
Value::scalar(
|
Value::scalar(
|
||||||
v.to_offset(UtcOffset::UTC)
|
v.to_offset(UtcOffset::UTC)
|
||||||
.format(&Rfc3339)
|
.format(&Rfc3339)
|
||||||
.unwrap_or_else(|e| panic!("Failed to format `DateTime`: {e}")),
|
.unwrap_or_else(|e| panic!("failed to format `DateTime`: {e}")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +203,7 @@ mod date_time {
|
||||||
/// Format of a [`UtcOffset` scalar][1].
|
/// Format of a [`UtcOffset` scalar][1].
|
||||||
///
|
///
|
||||||
/// [1]: https://graphql-scalars.dev/docs/scalars/utc-offset
|
/// [1]: https://graphql-scalars.dev/docs/scalars/utc-offset
|
||||||
const UTC_OFFSET_FORMAT: &[FormatItem<'_>] =
|
const UTC_OFFSET_FORMAT: &[BorrowedFormatItem<'_>] =
|
||||||
format_description!("[offset_hour sign:mandatory]:[offset_minute]");
|
format_description!("[offset_hour sign:mandatory]:[offset_minute]");
|
||||||
|
|
||||||
/// Offset from UTC in `±hh:mm` format. See [list of database time zones][0].
|
/// Offset from UTC in `±hh:mm` format. See [list of database time zones][0].
|
||||||
|
@ -227,7 +228,7 @@ mod utc_offset {
|
||||||
pub(super) fn to_output<S: ScalarValue>(v: &UtcOffset) -> Value<S> {
|
pub(super) fn to_output<S: ScalarValue>(v: &UtcOffset) -> Value<S> {
|
||||||
Value::scalar(
|
Value::scalar(
|
||||||
v.format(UTC_OFFSET_FORMAT)
|
v.format(UTC_OFFSET_FORMAT)
|
||||||
.unwrap_or_else(|e| panic!("Failed to format `UtcOffset`: {e}")),
|
.unwrap_or_else(|e| panic!("failed to format `UtcOffset`: {e}")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue