use sea_orm::entity::prelude::*; use time::OffsetDateTime; use uuid::Uuid; #[sea_orm::model] #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[sea_orm(table_name = "git_language")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(unique_key = "repo_language")] pub repo_id: Uuid, #[sea_orm(unique_key = "repo_language")] pub language: String, // 百分比以基点(basis points,0-10000)存储,避免浮点精度问题 pub percentage_bp: i32, pub size: i64, pub created_at: OffsetDateTime, #[sea_orm(belongs_to, from = "repo_id", to = "id")] pub repo: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}