use std::time::Duration;
use hyper_util::client::legacy::Client as HyperClient;
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::rt::TokioExecutor;
use clickhouse::{Client, error::Result};
#[tokio::main]
async fn main() -> Result<()> {
let connector = HttpConnector::new(); let hyper_client = HyperClient::builder(TokioExecutor::new())
.pool_idle_timeout(Duration::from_millis(2_500))
.pool_max_idle_per_host(4)
.build(connector);
let client = Client::with_http_client(hyper_client).with_url("http://localhost:8123");
let numbers = client
.query("SELECT number FROM system.numbers LIMIT 1")
.fetch_all::<u64>()
.await?;
println!("Numbers: {numbers:?}");
Ok(())
}