Crates.io | prusto |
lib.rs | prusto |
version | 0.5.1 |
source | src |
created_at | 2020-10-01 07:34:30.080384 |
updated_at | 2023-10-19 01:17:51.35149 |
description | A presto/trino client library |
homepage | https://github.com/nooberfsh/prusto |
repository | https://github.com/nooberfsh/prusto |
max_upload_size | |
id | 294917 |
size | 210,150 |
A presto/trino client library written in rust.
# Cargo.toml
[dependencies]
prusto = "0.5"
In order to use this crate as presto client, enable "presto" feature.
# Cargo.toml
[dependencies]
prusto = { version = "0.5", features = ["presto"] }
use prusto::{ClientBuilder, Presto};
#[derive(Presto, Debug)]
struct Foo {
a: i64,
b: f64,
c: String,
}
#[tokio::main]
async fn main() {
let cli = ClientBuilder::new("user", "localhost")
.port(8090)
.catalog("catalog")
.build()
.unwrap();
let sql = "select 1 as a, cast(1.1 as double) as b, 'bar' as c ";
let data = cli.get_all::<Foo>(sql.into()).await.unwrap().into_vec();
for r in data {
println!("{:?}", r)
}
}
MIT