use influxdb3_client::{Client, Point};
#[tokio::main]
async fn main() -> influxdb3_client::Result<()> {
let client = Client::from_env().await?;
println!(
"connected to {} (database {})",
client.config().host_url(),
client.config().database
);
client
.write(vec![Point::new("temperature")
.tag("location", "office")
.field("value", 22.5_f64)])
.await?;
let result = client
.sql("SELECT * FROM temperature ORDER BY time DESC LIMIT 5")
.await?;
for row in result {
println!("{:?}", row?.values());
}
Ok(())
}