Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,26 @@ keywords = ["async", "graphql", "mysql", "postgres", "sqlite"]
categories = ["database"]

[dependencies]
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
sea-orm = { version = "~1.1.4", default-features = false, features = ["seaography"] }
async-graphql = { version = "7.0", features = [
"decimal",
"chrono",
"dataloader",
"dynamic-schema",
] }
sea-orm = { git = "https://github.com/medheikelbouzayene/sea-orm.git", rev = "bc6fa6024721e53ff0044a7f0dcf02af3c38faed", default-features = false, features = [
"seaography",
] }
itertools = { version = "0.12.0" }
heck = { version = "0.4.1" }
thiserror = { version = "1.0.44" }
fnv = { version = "1.0.7" }
lazy_static = { version = "1.5" }

[dev-dependencies]
sea-orm = { git = "https://github.com/MedHeikelBouzayene/sea-orm.git", rev = "bc6fa6024721e53ff0044a7f0dcf02af3c38faed", default-features = false, features = [
"seaography",
] }

[features]
default = ["field-camel-case"]
with-json = ["sea-orm/with-json"]
Expand Down
8 changes: 6 additions & 2 deletions examples/postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ version = "1.1.3"
poem = { version = "3.0" }
async-graphql-poem = { version = "7.0" }
dotenv = "0.15.0"
sea-orm = { version = "~1.1.4", features = ["sqlx-postgres", "runtime-async-std-native-tls", "seaography"] }
sea-orm = { git = "https://github.com/medheikelbouzayene/sea-orm.git", rev = "bc6fa6024721e53ff0044a7f0dcf02af3c38faed", features = [
"sqlx-postgres",
"runtime-async-std-native-tls",
"seaography",
] }
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" }

[dependencies.seaography]
path = "../../"
version = "~1.1.3" # seaography version
version = "~1.1.3" # seaography version
features = ["with-decimal", "with-chrono", "with-postgres-array"]

[dev-dependencies]
Expand Down
12 changes: 9 additions & 3 deletions examples/postgres/src/entities/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::film_actor::Entity")]
#[sea_orm(
entity = "super::film_actor::Entity",
active_model = "super::film_actor::ActiveModel"
)]
FilmActor,
#[sea_orm(entity = "super::film::Entity")]
#[sea_orm(
entity = "super::film::Entity",
active_model = "super::film::ActiveModel"
)]
Film,
}
}
22 changes: 17 additions & 5 deletions examples/postgres/src/entities/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,24 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::city::Entity")]
#[sea_orm(
entity = "super::city::Entity",
active_model = "super::city::ActiveModel"
)]
City,
#[sea_orm(entity = "super::customer::Entity")]
#[sea_orm(
entity = "super::customer::Entity",
active_model = "super::customer::ActiveModel"
)]
Customer,
#[sea_orm(entity = "super::staff::Entity")]
#[sea_orm(
entity = "super::staff::Entity",
active_model = "super::staff::ActiveModel"
)]
Staff,
#[sea_orm(entity = "super::store::Entity")]
#[sea_orm(
entity = "super::store::Entity",
active_model = "super::store::ActiveModel"
)]
Store,
}
}
12 changes: 9 additions & 3 deletions examples/postgres/src/entities/category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::film_category::Entity")]
#[sea_orm(
entity = "super::film_category::Entity",
active_model = "super::film_category::ActiveModel"
)]
FilmCategory,
#[sea_orm(entity = "super::film::Entity")]
#[sea_orm(
entity = "super::film::Entity",
active_model = "super::film::ActiveModel"
)]
Film,
}
}
12 changes: 9 additions & 3 deletions examples/postgres/src/entities/city.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::address::Entity")]
#[sea_orm(
entity = "super::address::Entity",
active_model = "super::address::ActiveModel"
)]
Address,
#[sea_orm(entity = "super::country::Entity")]
#[sea_orm(
entity = "super::country::Entity",
active_model = "super::country::ActiveModel"
)]
Country,
}
}
7 changes: 5 additions & 2 deletions examples/postgres/src/entities/country.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::city::Entity")]
#[sea_orm(
entity = "super::city::Entity",
active_model = "super::city::ActiveModel"
)]
City,
}
}
22 changes: 17 additions & 5 deletions examples/postgres/src/entities/customer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,24 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::address::Entity")]
#[sea_orm(
entity = "super::address::Entity",
active_model = "super::address::ActiveModel"
)]
Address,
#[sea_orm(entity = "super::payment::Entity")]
#[sea_orm(
entity = "super::payment::Entity",
active_model = "super::payment::ActiveModel"
)]
Payment,
#[sea_orm(entity = "super::rental::Entity")]
#[sea_orm(
entity = "super::rental::Entity",
active_model = "super::rental::ActiveModel"
)]
Rental,
#[sea_orm(entity = "super::store::Entity")]
#[sea_orm(
entity = "super::store::Entity",
active_model = "super::store::ActiveModel"
)]
Store,
}
}
39 changes: 31 additions & 8 deletions examples/postgres/src/entities/film.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,41 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::film_actor::Entity")]
#[sea_orm(
entity = "super::film_actor::Entity",
active_model = "super::film_actor::ActiveModel"
)]
FilmActor,
#[sea_orm(entity = "super::film_category::Entity")]
#[sea_orm(
entity = "super::film_category::Entity",
active_model = "super::film_category::ActiveModel"
)]
FilmCategory,
#[sea_orm(entity = "super::inventory::Entity")]
#[sea_orm(
entity = "super::inventory::Entity",
active_model = "super::inventory::ActiveModel"
)]
Inventory,
#[sea_orm(entity = "super::language::Entity", def = "Relation::Language2.def()")]
#[sea_orm(
entity = "super::language::Entity",
active_model = "super::language::ActiveModel",
def = "Relation::Language2.def()"
)]
Language2,
#[sea_orm(entity = "super::language::Entity", def = "Relation::Language1.def()")]
#[sea_orm(
entity = "super::language::Entity",
active_model = "super::language::ActiveModel",
def = "Relation::Language1.def()"
)]
Language1,
#[sea_orm(entity = "super::actor::Entity")]
#[sea_orm(
entity = "super::actor::Entity",
active_model = "super::actor::ActiveModel"
)]
Actor,
#[sea_orm(entity = "super::category::Entity")]
#[sea_orm(
entity = "super::category::Entity",
active_model = "super::category::ActiveModel"
)]
Category,
}
}
12 changes: 9 additions & 3 deletions examples/postgres/src/entities/film_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::actor::Entity")]
#[sea_orm(
entity = "super::actor::Entity",
active_model = "super::actor::ActiveModel"
)]
Actor,
#[sea_orm(entity = "super::film::Entity")]
#[sea_orm(
entity = "super::film::Entity",
active_model = "super::film::ActiveModel"
)]
Film,
}
}
12 changes: 9 additions & 3 deletions examples/postgres/src/entities/film_category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::category::Entity")]
#[sea_orm(
entity = "super::category::Entity",
active_model = "super::category::ActiveModel"
)]
Category,
#[sea_orm(entity = "super::film::Entity")]
#[sea_orm(
entity = "super::film::Entity",
active_model = "super::film::ActiveModel"
)]
Film,
}
}
17 changes: 13 additions & 4 deletions examples/postgres/src/entities/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,19 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::film::Entity")]
#[sea_orm(
entity = "super::film::Entity",
active_model = "super::film::ActiveModel"
)]
Film,
#[sea_orm(entity = "super::rental::Entity")]
#[sea_orm(
entity = "super::rental::Entity",
active_model = "super::rental::ActiveModel"
)]
Rental,
#[sea_orm(entity = "super::store::Entity")]
#[sea_orm(
entity = "super::store::Entity",
active_model = "super::store::ActiveModel"
)]
Store,
}
}
2 changes: 1 addition & 1 deletion examples/postgres/src/entities/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {}
pub enum RelatedEntity {}
4 changes: 3 additions & 1 deletion examples/postgres/src/entities/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.4

pub mod prelude;

pub mod actor;
Expand All @@ -15,4 +17,4 @@ pub mod payment;
pub mod rental;
pub mod sea_orm_active_enums;
pub mod staff;
pub mod store;
pub mod store;
17 changes: 13 additions & 4 deletions examples/postgres/src/entities/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,19 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::customer::Entity")]
#[sea_orm(
entity = "super::customer::Entity",
active_model = "super::customer::ActiveModel"
)]
Customer,
#[sea_orm(entity = "super::rental::Entity")]
#[sea_orm(
entity = "super::rental::Entity",
active_model = "super::rental::ActiveModel"
)]
Rental,
#[sea_orm(entity = "super::staff::Entity")]
#[sea_orm(
entity = "super::staff::Entity",
active_model = "super::staff::ActiveModel"
)]
Staff,
}
}
2 changes: 1 addition & 1 deletion examples/postgres/src/entities/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ pub use super::language::Entity as Language;
pub use super::payment::Entity as Payment;
pub use super::rental::Entity as Rental;
pub use super::staff::Entity as Staff;
pub use super::store::Entity as Store;
pub use super::store::Entity as Store;
22 changes: 17 additions & 5 deletions examples/postgres/src/entities/rental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,24 @@ impl ActiveModelBehavior for ActiveModel {}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::customer::Entity")]
#[sea_orm(
entity = "super::customer::Entity",
active_model = "super::customer::ActiveModel"
)]
Customer,
#[sea_orm(entity = "super::inventory::Entity")]
#[sea_orm(
entity = "super::inventory::Entity",
active_model = "super::inventory::ActiveModel"
)]
Inventory,
#[sea_orm(entity = "super::payment::Entity")]
#[sea_orm(
entity = "super::payment::Entity",
active_model = "super::payment::ActiveModel"
)]
Payment,
#[sea_orm(entity = "super::staff::Entity")]
#[sea_orm(
entity = "super::staff::Entity",
active_model = "super::staff::ActiveModel"
)]
Staff,
}
}
6 changes: 3 additions & 3 deletions examples/postgres/src/entities/sea_orm_active_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use sea_orm::entity::prelude::*;
pub enum MpaaRating {
#[sea_orm(string_value = "G")]
G,
#[sea_orm(string_value = "NC-17")]
Nc17,
#[sea_orm(string_value = "PG")]
Pg,
#[sea_orm(string_value = "PG-13")]
Pg13,
#[sea_orm(string_value = "R")]
R,
}
#[sea_orm(string_value = "NC-17")]
Nc17,
}
Loading