use std::marker::PhantomData; use uuid::Uuid; #[derive(Debug, Clone, PartialEq)] 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 } } mod __sea_orm_newtype_id_mod { use super::*; impl From> for sea_orm_newtype::Value { fn from(value: Id) -> Self { Into::::into(value).into() } } impl sea_orm_newtype::TryGetable for Id { fn try_get_by( res: &sea_orm_newtype::sea_orm::QueryResult, index: I, ) -> Result { Ok(Into::::into(res.try_get_by::(index)?)) } } impl sea_orm_newtype::ValueType for Id { fn try_from( v: sea_orm_newtype::Value, ) -> Result { Ok(Into::::into( ::try_from(v)?, )) } fn type_name() -> String { ::type_name() } fn array_type() -> sea_orm_newtype::sea_query::ArrayType { ::array_type() } fn column_type() -> sea_orm_newtype::sea_query::ColumnType { ::column_type() } } impl sea_orm_newtype::Nullable for Id { fn null() -> sea_orm_newtype::Value { ::null() } } impl sea_orm_newtype::TryFromU64 for Id { fn try_from_u64(n: u64) -> Result { Ok(Into::::into( ::try_from_u64(n)?, )) } } } 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() {}