diff --git a/Cargo.lock b/Cargo.lock index 25dc2672..79203ca9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -461,9 +461,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", @@ -471,7 +471,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] diff --git a/aw-client-rust/src/lib.rs b/aw-client-rust/src/lib.rs index dca5bb54..06a85b28 100644 --- a/aw-client-rust/src/lib.rs +++ b/aw-client-rust/src/lib.rs @@ -115,7 +115,7 @@ impl AwClient { self.client .post(url) .json(&json!({ - "query": query, + "query": query.split('\n').collect::>(), "timeperiods": timeperiods_str, })) .send() diff --git a/aw-client-rust/tests/test.rs b/aw-client-rust/tests/test.rs index cce54a5f..d518aa0a 100644 --- a/aw-client-rust/tests/test.rs +++ b/aw-client-rust/tests/test.rs @@ -110,6 +110,22 @@ mod test { println!("Events: {events:?}"); assert!(events[0].duration == Duration::seconds(1)); + // Query + let query = format!( + "events = query_bucket(\"{}\"); +RETURN = events;", + bucket.id + ); + let start: DateTime = DateTime::parse_from_rfc3339("1996-12-19T00:00:00-08:00") + .unwrap() + .into(); + let end: DateTime = DateTime::parse_from_rfc3339("2020-12-19T00:00:00-08:00") + .unwrap() + .into(); + let timeperiods = (start, end); + let query_result = client.query(&query, vec![timeperiods]).unwrap(); + println!("Query result: {query_result:?}"); + client .delete_event(&bucketname, events[0].id.unwrap()) .unwrap();