Skip to content

Commit 3fb3b58

Browse files
committed
1.0.8
1 parent 7351ed5 commit 3fb3b58

1 file changed

Lines changed: 26 additions & 79 deletions

File tree

src/bin/main.rs

Lines changed: 26 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -8,91 +8,38 @@ use napi::tokio_stream::StreamExt;
88
async fn main() {
99
// std::env::set_var("RUST_LOG", "hyper=trace,tonic=trace,h2=trace");
1010
// tracing_subscriber::fmt::init();
11-
12-
let mut client = influxdb3_napi::client::InfluxDBClient::new(
13-
// String::from("http://165.232.154.186:8195"),
14-
// Some(String::from("apiv3_64thndtOkGj3gpj5Mc3IwgSN9jKJ6c2Jle4-sJdQwsZ5nIThBjT9ALB0GjEpXvSgt2ZotiQzLbdtbFTEi8S2hg")),
15-
String::from("http://165.232.154.186:8192"),
16-
Some(String::from("apiv3_3UbvWHEjw_1Jo9qaz0DrH0g59mA_o6KxsDb8WTZI5Gd5PvzTOvD_UDocfMZ1yqnyvJmBd2Wrkkx8MXfVgcpDew")),
17-
Some(influxdb3_napi::serializer::Serializer::Library),
18-
None
19-
);
20-
21-
let mut response = client
22-
.query(QueryPayload {
23-
database: "sample-air-sensor-1754383690707".to_string(),
24-
query: "SELECT * FROM system.last_caches".to_string(),
25-
_type: Some(QueryType::Sql),
26-
params: None,
27-
})
28-
.await
29-
.unwrap();
30-
31-
match response {
32-
Either3::A(mut data) => match data.next().await {
33-
Some(Ok(res)) => {
34-
println!("result is {:?}", res)
35-
}
36-
_ => println!("no result found"),
37-
},
38-
_ => panic!(),
39-
}
40-
41-
// for _ in 0..10 {
42-
// let start = Instant::now();
43-
// let mut response = client
44-
// .query(
45-
// String::from("_internal"),
46-
// String::from("SELECT * FROM system.databases"),
47-
// Some(QueryType::Sql),
4811
//
49-
// )
50-
// .await
51-
// .unwrap();
52-
// //
5312
//
54-
// match response.next().await {
55-
// Ok(res) => match res {
56-
// Some(data) => {
57-
// // println!("result is {:?}", data);
58-
// println!("Time elapsed: {:?}", start.elapsed());
59-
// }
60-
// None => {
61-
// println!("Empty response");
62-
// }
63-
// },
64-
// Err(e) => {
65-
// println!("Error occurred while the request {}", e);
66-
// }
67-
// }
68-
// }
69-
70-
// napi::tokio::time::sleep(Duration::from_secs(10)).await;
71-
// let mut point = Point::from_measurement(String::from("test_measurement"));
7213
//
73-
// let mut fields: HashMap<String, Either5<bool, f64, u32, i64, String>> = HashMap::new();
74-
// fields.insert(String::from("A"), Either5::C(4));
75-
// fields.insert(String::from("B"), Either5::B(3.));
7614
//
77-
// point.set_fields(fields).expect("TODO: panic message");
15+
// let mut client = influxdb3_napi::client::InfluxDBClient::new(
16+
// // String::from("http://165.232.154.186:8195"),
17+
// // Some(String::from("apiv3_64thndtOkGj3gpj5Mc3IwgSN9jKJ6c2Jle4-sJdQwsZ5nIThBjT9ALB0GjEpXvSgt2ZotiQzLbdtbFTEi8S2hg")),
18+
// String::from("http://165.232.154.186:8192"),
19+
// Some(String::from("apiv3_3UbvWHEjw_1Jo9qaz0DrH0g59mA_o6KxsDb8WTZI5Gd5PvzTOvD_UDocfMZ1yqnyvJmBd2Wrkkx8MXfVgcpDew")),
20+
// Some(influxdb3_napi::serializer::Serializer::Library),
21+
// None
22+
// );
7823
//
79-
// println!("Full elapsed time: {:?}", start.elapsed());
80-
//
81-
// println!("Line protocol: {:?}", point.to_line_protocol(None, None));
82-
//
83-
// let mut write_options = WriteOptions::default();
84-
// write_options.no_sync = Some(true);
85-
//
86-
// // client.write(vec![String::from("cpu,host=server01 usage=85.2 1638360000000")], String::from("test"), Some(write_options), None).await;
87-
// client
88-
// .write(
89-
// vec![point.to_line_protocol(None, None).unwrap()],
90-
// String::from("test_line"),
91-
// Some(write_options),
92-
// None,
93-
// )
24+
// let mut response = client
25+
// .query(QueryPayload {
26+
// database: "sample-air-sensor-1754383690707".to_string(),
27+
// query: "SELECT * FROM system.last_caches".to_string(),
28+
// _type: Some(QueryType::Sql),
29+
// params: None,
30+
// })
9431
// .await
95-
// .expect("TODO: panic message");
32+
// .unwrap();
33+
//
34+
// match response {
35+
// Either3::A(mut data) => match data.next().await {
36+
// Some(Ok(res)) => {
37+
// println!("result is {:?}", res)
38+
// }
39+
// _ => println!("no result found"),
40+
// },
41+
// _ => panic!(),
42+
// }
9643
}
9744

9845
#[tokio::main]

0 commit comments

Comments
 (0)