Skip to content

Commit 29463d8

Browse files
committed
cargo fmt
1 parent eb0f799 commit 29463d8

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

packages/cubejs-backend-native/src/node_obj_deserializer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ impl<'de, 'a, 'b> Deserializer<'de> for JsValueDeserializer<'a, 'b> {
130130
|| self.value.is_a::<JsUndefined, _>(self.cx)
131131
{
132132
visitor.visit_none()
133-
} else if self.value.is_a::<JsFunction, _>(self.cx)
134-
{
133+
} else if self.value.is_a::<JsFunction, _>(self.cx) {
135134
// We can do nothing with the JS functions in native
136135
// so let's save them as string for potential usage later
137136
// in JS side if needed

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)