cardamon 0.2.0

Cardamon is a tool to help development teams measure the power consumption and carbon emissions of their software.
Documentation
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0

use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "run")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    pub is_live: bool,
    pub cpu_id: i32,
    pub start_time: i64,
    pub stop_time: i64,
    pub region: Option<String>,
    #[sea_orm(column_type = "Double")]
    pub carbon_intensity: f64,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::cpu::Entity",
        from = "Column::CpuId",
        to = "super::cpu::Column::Id",
        on_update = "NoAction",
        on_delete = "NoAction"
    )]
    Cpu,
    #[sea_orm(has_many = "super::iteration::Entity")]
    Iteration,
    #[sea_orm(has_many = "super::metrics::Entity")]
    Metrics,
}

impl Related<super::cpu::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::Cpu.def()
    }
}

impl Related<super::iteration::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::Iteration.def()
    }
}

impl Related<super::metrics::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::Metrics.def()
    }
}

impl ActiveModelBehavior for ActiveModel {}