use std::marker::PhantomData; use uuid::Uuid; use sea_orm_newtype::DeriveNewType; #[derive(Debug, Clone, PartialEq, DeriveNewType)] #[sea_orm_newtype(from_into = "Uuid", primary_key)] pub struct Id(Uuid, PhantomData); impl From for Id { fn from(id: Uuid) -> Id { Id(id, PhantomData) } } impl From> for Uuid { fn from(value: Id) -> Self { value.0 } } use sea_orm::entity::prelude::*; #[derive(Debug, Clone, PartialEq)] pub struct ModelId; #[derive(Clone, Debug, DeriveEntityModel)] #[sea_orm(table_name = "foo")] pub struct Model { #[sea_orm(primary_key)] id: Id, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation {} impl ActiveModelBehavior for ActiveModel {} fn main() {}