-
-
Notifications
You must be signed in to change notification settings - Fork 500
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix - vector of float & double does not derive Eq (#1158)
* Fix - vector of float & double does not derive Eq * clippy Co-authored-by: Chris Tsang <[email protected]>
- Loading branch information
Showing
6 changed files
with
205 additions
and
10 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
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
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,17 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 | ||
|
||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "collection_float")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub id: i32, | ||
pub floats: Vec<f32> , | ||
pub doubles: Vec<f64> , | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation {} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
17 changes: 17 additions & 0 deletions
17
sea-orm-codegen/tests/compact_with_schema_name/collection_float.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,17 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 | ||
|
||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(schema_name = "schema_name", table_name = "collection_float")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub id: i32, | ||
pub floats: Vec<f32> , | ||
pub doubles: Vec<f64> , | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation {} | ||
|
||
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,60 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 | ||
|
||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Copy, Clone, Default, Debug, DeriveEntity)] | ||
pub struct Entity; | ||
|
||
impl EntityName for Entity { | ||
fn table_name(&self) -> &str { | ||
"collection_float" | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] | ||
pub struct Model { | ||
pub id: i32, | ||
pub floats: Vec<f32> , | ||
pub doubles: Vec<f64> , | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] | ||
pub enum Column { | ||
Id, | ||
Floats, | ||
Doubles, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] | ||
pub enum PrimaryKey { | ||
Id, | ||
} | ||
|
||
impl PrimaryKeyTrait for PrimaryKey { | ||
type ValueType = i32; | ||
fn auto_increment() -> bool { | ||
true | ||
} | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter)] | ||
pub enum Relation {} | ||
|
||
impl ColumnTrait for Column { | ||
type EntityName = Entity; | ||
fn def(&self) -> ColumnDef { | ||
match self { | ||
Self::Id => ColumnType::Integer.def(), | ||
Self::Floats => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Float)).def(), | ||
Self::Doubles => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Double)).def(), | ||
} | ||
} | ||
} | ||
|
||
impl RelationTrait for Relation { | ||
fn def(&self) -> RelationDef { | ||
panic!("No RelationDef") | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
64 changes: 64 additions & 0 deletions
64
sea-orm-codegen/tests/expanded_with_schema_name/collection_float.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,64 @@ | ||
//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 | ||
|
||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Copy, Clone, Default, Debug, DeriveEntity)] | ||
pub struct Entity; | ||
|
||
impl EntityName for Entity { | ||
fn schema_name(&self) -> Option< &str > { | ||
Some("schema_name") | ||
} | ||
|
||
fn table_name(&self) -> &str { | ||
"collection_float" | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] | ||
pub struct Model { | ||
pub id: i32, | ||
pub floats: Vec<f32> , | ||
pub doubles: Vec<f64> , | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] | ||
pub enum Column { | ||
Id, | ||
Floats, | ||
Doubles, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] | ||
pub enum PrimaryKey { | ||
Id, | ||
} | ||
|
||
impl PrimaryKeyTrait for PrimaryKey { | ||
type ValueType = i32; | ||
fn auto_increment() -> bool { | ||
true | ||
} | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter)] | ||
pub enum Relation {} | ||
|
||
impl ColumnTrait for Column { | ||
type EntityName = Entity; | ||
fn def(&self) -> ColumnDef { | ||
match self { | ||
Self::Id => ColumnType::Integer.def(), | ||
Self::Floats => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Float)).def(), | ||
Self::Doubles => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Double)).def(), | ||
} | ||
} | ||
} | ||
|
||
impl RelationTrait for Relation { | ||
fn def(&self) -> RelationDef { | ||
panic!("No RelationDef") | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |