-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fcef01
commit c05c180
Showing
4 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] | ||
#[sea_orm(table_name = "predicate")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub id: i32, | ||
pub data: Json, | ||
pub variant: i32, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm(has_many = "super::predicate_logical_expression_junction::Entity")] | ||
PredicateLogicalExpressionJunction, | ||
#[sea_orm(has_many = "super::predicate_physical_expression_junction::Entity")] | ||
PredicatePhysicalExpressionJunction, | ||
} | ||
|
||
impl Related<super::predicate_logical_expression_junction::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::PredicateLogicalExpressionJunction.def() | ||
} | ||
} | ||
|
||
impl Related<super::predicate_physical_expression_junction::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::PredicatePhysicalExpressionJunction.def() | ||
} | ||
} | ||
|
||
impl Related<super::logical_expression::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
super::predicate_logical_expression_junction::Relation::LogicalExpression.def() | ||
} | ||
fn via() -> Option<RelationDef> { | ||
Some( | ||
super::predicate_logical_expression_junction::Relation::Predicate | ||
.def() | ||
.rev(), | ||
) | ||
} | ||
} | ||
|
||
impl Related<super::physical_expression::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
super::predicate_physical_expression_junction::Relation::PhysicalExpression.def() | ||
} | ||
fn via() -> Option<RelationDef> { | ||
Some( | ||
super::predicate_physical_expression_junction::Relation::Predicate | ||
.def() | ||
.rev(), | ||
) | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] | ||
#[sea_orm(table_name = "predicate_children")] | ||
pub struct Model { | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub parent_id: i32, | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub child_id: i32, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::predicate::Entity", | ||
from = "Column::ChildId", | ||
to = "super::predicate::Column::Id", | ||
on_update = "Cascade", | ||
on_delete = "Cascade" | ||
)] | ||
Predicate2, | ||
#[sea_orm( | ||
belongs_to = "super::predicate::Entity", | ||
from = "Column::ParentId", | ||
to = "super::predicate::Column::Id", | ||
on_update = "Cascade", | ||
on_delete = "Cascade" | ||
)] | ||
Predicate1, | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
46 changes: 46 additions & 0 deletions
46
optd-persistent/src/entities/predicate_logical_expression_junction.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] | ||
#[sea_orm(table_name = "predicate_logical_expression_junction")] | ||
pub struct Model { | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub logical_expr_id: i32, | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub predicate_id: i32, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::logical_expression::Entity", | ||
from = "Column::LogicalExprId", | ||
to = "super::logical_expression::Column::Id", | ||
on_update = "Cascade", | ||
on_delete = "Cascade" | ||
)] | ||
LogicalExpression, | ||
#[sea_orm( | ||
belongs_to = "super::predicate::Entity", | ||
from = "Column::PredicateId", | ||
to = "super::predicate::Column::Id", | ||
on_update = "Cascade", | ||
on_delete = "Cascade" | ||
)] | ||
Predicate, | ||
} | ||
|
||
impl Related<super::logical_expression::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::LogicalExpression.def() | ||
} | ||
} | ||
|
||
impl Related<super::predicate::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Predicate.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
46 changes: 46 additions & 0 deletions
46
optd-persistent/src/entities/predicate_physical_expression_junction.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] | ||
#[sea_orm(table_name = "predicate_physical_expression_junction")] | ||
pub struct Model { | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub physical_expr_id: i32, | ||
#[sea_orm(primary_key, auto_increment = false)] | ||
pub predicate_id: i32, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::physical_expression::Entity", | ||
from = "Column::PhysicalExprId", | ||
to = "super::physical_expression::Column::Id", | ||
on_update = "Cascade", | ||
on_delete = "Cascade" | ||
)] | ||
PhysicalExpression, | ||
#[sea_orm( | ||
belongs_to = "super::predicate::Entity", | ||
from = "Column::PredicateId", | ||
to = "super::predicate::Column::Id", | ||
on_update = "Cascade", | ||
on_delete = "Cascade" | ||
)] | ||
Predicate, | ||
} | ||
|
||
impl Related<super::physical_expression::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::PhysicalExpression.def() | ||
} | ||
} | ||
|
||
impl Related<super::predicate::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Predicate.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |