Skip to content

Commit ba0ab92

Browse files
committed
convert core data types from api gateway
1 parent a100d6a commit ba0ab92

File tree

5 files changed

+476
-4
lines changed

5 files changed

+476
-4
lines changed

rust/cubeorchestrator/Cargo.lock

Lines changed: 204 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/cubeorchestrator/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7+
chrono = "0.4.38"
78
cubeshared = { path = "../cubeshared" }
9+
serde = { version = "1.0.215", features = ["derive"] }
10+
serde_json = "1.0.133"
811

912
[dependencies.neon]
1013
version = "=1"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use chrono::SecondsFormat;
2+
use crate::types::{DBResponsePrimitive, DBResponseValue};
3+
4+
pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive {
5+
match value {
6+
DBResponseValue::DateTime(dt) if type_ == "time" || type_.is_empty() => {
7+
let formatted = dt.to_rfc3339_opts(SecondsFormat::Millis, true);
8+
DBResponsePrimitive::String(formatted)
9+
}
10+
DBResponseValue::Primitive(p) => p,
11+
DBResponseValue::Object { value } => value,
12+
_ => DBResponsePrimitive::Null,
13+
}
14+
}
15+

rust/cubeorchestrator/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
pub mod cubestore_message_parser;
2+
pub mod cubestore_result_transform;
3+
pub mod types;

0 commit comments

Comments
 (0)