github-analytics 0.1.0

This small tool will report/save the PRs and issues opened on the StarkWare exploration team's repos
Documentation
use std::collections::HashMap;

use eyre::Result;
use influxdb::{Client, InfluxDbWriteable, WriteQuery};

use crate::models::Interaction;

/// Push the data to the influxdb database.
///
/// # Arguments
///
/// * `repo_infos` - A HashMap containing the interactions
pub async fn push_data(repo_infos: &HashMap<String, Vec<Interaction>>) -> Result<()> {
    let client = Client::new("http://localhost:8086", "test");
    let interactions = repo_infos
        .clone()
        .into_values()
        .flatten()
        .map(|inter| inter.into_query("interaction"))
        .collect::<Vec<WriteQuery>>();

    let write_result = client.query(interactions).await;
    write_result.unwrap();

    Ok(())
}