Crates.io | duners |
lib.rs | duners |
version | 0.0.2 |
source | src |
created_at | 2022-12-27 14:42:17.180895 |
updated_at | 2023-11-28 22:32:08.128525 |
description | A simple framework for fetching query results from with [Dune Analytics API](https://dune.com/docs/api/). |
homepage | |
repository | https://github.com/bh2smith/duners/ |
max_upload_size | |
id | 746261 |
size | 37,165 |
A convenience library for executing queries and recovering results from Dune Analytics API.
cargo add duners
use chrono::{DateTime, Utc};
use duners::{client::DuneClient, dateutil::datetime_from_str};
use serde::Deserialize;
// User must declare the expected query return fields and types!
#[derive(Deserialize, Debug, PartialEq)]
struct ResultStruct {
text_field: String,
number_field: f64,
#[serde(deserialize_with = "datetime_from_str")]
date_field: DateTime<Utc>,
list_field: String,
}
#[tokio::main]
async fn main() -> Result<(), DuneRequestError> {
let dune = DuneClient::from_env();
let results = dune.refresh::<ResultStruct>(1215383, None, None).await?;
println!("{:?}", results.get_rows());
Ok(())
}