-
-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Postgres network types (inet
)
#888
Comments
Hey @001wwang, sorry for the delay. Network types are supported on SeaQuery, however, it's only supported by PostgreSQL but not by MySQL and SQLite. So, the questions was do we want to bring the network types support to SeaORM for PostgreSQL only? Or, support it for MySQL and SQLite as well. We can simply serialize network types as string for MySQL and SQLite. Thoughts? CC @tyt2y3 |
No worries at all, this is not a blocker for us. We only use PostgreSQL so I'll hold off on any judgement for MySQL and SQLite. Thanks for the context. |
@billy1624 I think support network types only for PostgreSQL (for example SqlAlchemy, python ORM, support it only for PostgreSQL). |
@tyt2y3 @billy1624 if it's, I can prepare PR) |
Let me think about it |
Any updates? @tyt2y3 |
I would like this feature! Question about implementation: to what Rust type would |
One option would be Another option is |
What is the current progress on this issue? I found that sqlx already provides inet type support for postgresql :https://github.com/launchbadge/sqlx/blob/main/sqlx-postgres/src/types/ipnetwork.rs |
The issue is still outstanding. No concrete plan for it yet. |
sea-orm/src/driver/sqlx_postgres.rs Lines 559 to 573 in 039e442
|
With roughly this set of dependencies and features
where, sea-query and sea-query-binder are only needed because sea-orm has no "with-ipnetwork" feature that would get passed onwards,
and use it with |
Of course it'd be nicer if we can integrate this all into SeaORM. |
I found it is hard to implement Although Therefore, I tried to implement it in sea_orm directly and submit a draft PR. |
Motivation
I would like to use Postgres network types (i.e.
inet
) in myModel
definitions. I understand there may be workarounds, so this is not urgent but would be a quality-of-life improvement.Proposed Solutions
I believe this is nearly/already supported in
sea-query
: SeaQL/sea-query#187. From my understanding, supporting this insea-orm
requires updating the logic that converts a query result into an instance of aModel
: perhaps here.Additional Information
Currently, attempts to use
inet
will result in a runtime error.The text was updated successfully, but these errors were encountered: