Generate entity with sea-orm-cli with an inet postgres column #2966
Unanswered
TheDarkSword
asked this question in
Q&A
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a table in postgres with a column that has the inet type. If i use sea-orm-cli (2.0.0-rc.30) the entity is:
//!
SeaORMEntity, generated by sea-orm-codegen 2.0use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "my_table")]
pub struct Model {
#[sea_orm(primary_key)]
pub uid: i64,
#[sea_orm(ignore, column_type = "custom("inet")", select_as = "text", nullable)]
pub ip_address: Option,
}
impl ActiveModelBehavior for ActiveModel {}
It is ignored but I need it as String (or better IpNetwork). I enabled de feature "with-ipnetwork" but nothing changed.
I'm doing something wrong or this is a bug?
This is my sea-orm dependency:
sea-orm = { version = "2.0.0-rc.30", features = [ "sqlx-postgres", "runtime-tokio-native-tls", "macros", "with-rust_decimal", "with-ipnetwork" ] }
This is the sea-orm-cli comman that I use:
sea-orm-cli generate entity -o src/entities/ --with-serde both --entity-format dense
Thank you very much for any help!
Beta Was this translation helpful? Give feedback.
All reactions