Skip to content

Commit 5a1b6d3

Browse files
committed
cargo fmt
1 parent 2765e78 commit 5a1b6d3

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

rust/cubeorchestrator/src/query_result_transform.rs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,42 @@ pub const MEMBER_SEPARATOR: &str = ".";
2626
pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive {
2727
match value {
2828
DBResponseValue::DateTime(dt) if type_ == "time" || type_.is_empty() => {
29-
DBResponsePrimitive::String(dt.with_timezone(&Utc).format("%Y-%m-%dT%H:%M:%S%.3f").to_string())
29+
DBResponsePrimitive::String(
30+
dt.with_timezone(&Utc)
31+
.format("%Y-%m-%dT%H:%M:%S%.3f")
32+
.to_string(),
33+
)
3034
}
3135
DBResponseValue::Primitive(DBResponsePrimitive::String(ref s)) if type_ == "time" => {
3236
let formatted = DateTime::parse_from_rfc3339(s)
3337
.map(|dt| dt.format("%Y-%m-%dT%H:%M:%S%.3f").to_string())
3438
.or_else(|_| {
35-
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f")
36-
.map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string())
39+
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f").map(|dt| {
40+
Utc.from_utc_datetime(&dt)
41+
.format("%Y-%m-%dT%H:%M:%S%.3f")
42+
.to_string()
43+
})
3744
})
3845
.or_else(|_| {
39-
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S")
40-
.map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string())
46+
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S").map(|dt| {
47+
Utc.from_utc_datetime(&dt)
48+
.format("%Y-%m-%dT%H:%M:%S%.3f")
49+
.to_string()
50+
})
4151
})
4252
.or_else(|_| {
43-
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %Z")
44-
.map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string())
53+
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %Z").map(|dt| {
54+
Utc.from_utc_datetime(&dt)
55+
.format("%Y-%m-%dT%H:%M:%S%.3f")
56+
.to_string()
57+
})
4558
})
4659
.or_else(|_| {
47-
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %:z")
48-
.map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string())
60+
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %:z").map(|dt| {
61+
Utc.from_utc_datetime(&dt)
62+
.format("%Y-%m-%dT%H:%M:%S%.3f")
63+
.to_string()
64+
})
4965
})
5066
.unwrap_or_else(|_| s.clone());
5167
DBResponsePrimitive::String(formatted)

0 commit comments

Comments
 (0)