2 unstable releases

0.2.0 Feb 7, 2022
0.1.0 Oct 1, 2020

#4 in #presto

Download history 157/week @ 2024-03-13 56/week @ 2024-03-20 42/week @ 2024-03-27 176/week @ 2024-04-03 173/week @ 2024-04-10 97/week @ 2024-04-17 106/week @ 2024-04-24 114/week @ 2024-05-01 303/week @ 2024-05-08 249/week @ 2024-05-15 119/week @ 2024-05-22 102/week @ 2024-05-29 148/week @ 2024-06-05 231/week @ 2024-06-12 230/week @ 2024-06-19 132/week @ 2024-06-26

755 downloads per month
Used in 3 crates (2 directly)

MIT license

9KB
140 lines

Prusto

A presto/trino client library written in rust.

Installation

# 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"] }

Example

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)
    }
}

License

MIT

Dependencies

~1.5MB
~34K SLoC