//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Copy, Clone, Default, Debug, DeriveEntity)] pub struct Entity; impl EntityName for Entity { fn table_name(&self) -> &str { "addresses" } } #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] pub struct Model { pub id: String, pub customer_id: Option, pub company: Option, pub first_name: Option, pub last_name: Option, pub address_1: Option, pub address_2: Option, pub city: Option, pub country_code: Option, pub province: Option, pub postal_code: Option, pub phone: Option, pub created_at: DateTimeWithTimeZone, pub updated_at: DateTimeWithTimeZone, pub deleted_at: Option, pub metadata: Option, } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] pub enum Column { Id, CustomerId, Company, FirstName, LastName, Address1, Address2, City, CountryCode, Province, PostalCode, Phone, CreatedAt, UpdatedAt, DeletedAt, Metadata, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] pub enum PrimaryKey { Id, } impl PrimaryKeyTrait for PrimaryKey { type ValueType = String; fn auto_increment() -> bool { false } } #[derive(Copy, Clone, Debug, EnumIter)] pub enum Relation { ClaimOrders, Countries, Customers, Swaps, } impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { Self::Id => ColumnType::String(None).def(), Self::CustomerId => ColumnType::String(None).def().null(), Self::Company => ColumnType::String(None).def().null(), Self::FirstName => ColumnType::String(None).def().null(), Self::LastName => ColumnType::String(None).def().null(), Self::Address1 => ColumnType::String(None).def().null(), Self::Address2 => ColumnType::String(None).def().null(), Self::City => ColumnType::String(None).def().null(), Self::CountryCode => ColumnType::String(None).def().null(), Self::Province => ColumnType::String(None).def().null(), Self::PostalCode => ColumnType::String(None).def().null(), Self::Phone => ColumnType::String(None).def().null(), Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), Self::Metadata => ColumnType::JsonBinary.def().null(), } } } impl RelationTrait for Relation { fn def(&self) -> RelationDef { match self { Self::ClaimOrders => Entity::has_many(super::claim_orders::Entity).into(), Self::Countries => Entity::belongs_to(super::countries::Entity) .from(Column::CountryCode) .to(super::countries::Column::Iso2) .into(), Self::Customers => Entity::belongs_to(super::customers::Entity) .from(Column::CustomerId) .to(super::customers::Column::Id) .into(), Self::Swaps => Entity::has_many(super::swaps::Entity).into(), } } } impl Related for Entity { fn to() -> RelationDef { Relation::ClaimOrders.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::Countries.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::Customers.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::Swaps.def() } } impl ActiveModelBehavior for ActiveModel {}