cardamon 0.2.0

Cardamon is a tool to help development teams measure the power consumption and carbon emissions of their software.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use crate::entities::cpu;
use anyhow::{self, Context};
use sea_orm::*;

pub async fn fetch_by_name(name: &str, db: &DatabaseConnection) -> anyhow::Result<cpu::Model> {
    cpu::Entity::find()
        .filter(cpu::Column::Name.eq(name))
        .one(db)
        .await?
        .context(format!("Error fetching CPU with name {}", name))
}