2 unstable releases

0.2.0 Feb 7, 2022
0.1.0 Oct 1, 2020

#4 in #presto

Download history 127/week @ 2023-12-05 66/week @ 2023-12-12 156/week @ 2024-01-02 19/week @ 2024-01-09 75/week @ 2024-01-16 47/week @ 2024-01-23 264/week @ 2024-01-30 114/week @ 2024-02-06 339/week @ 2024-02-13 346/week @ 2024-02-20 198/week @ 2024-02-27 197/week @ 2024-03-05 199/week @ 2024-03-12 51/week @ 2024-03-19

687 downloads per month
Used in 2 crates

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
~33K SLoC