#presto #prestosql #client #macro #prusto #presto-trino

prusto-macros

prusto macros

2 个不稳定版本

0.2.0 2022 年 2 月 7 日
0.1.0 2020 年 10 月 1 日

#4#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 每月下载量
3crate(2 个直接使用)中使用

MIT 协议

9KB
140

Prusto

一个用 Rust 编写的 presto/trino 客户端库。

安装

# Cargo.toml
[dependencies]
prusto = "0.5"

为了将此 crate 作为 presto 客户端使用,请启用 "presto" 功能。

# 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

依赖

~1.5MB
~34K SLoC