sea-query
sea-query copied to clipboard
PostgreSQL ipaddr/cidr/macaddress
It would be great to see support for the postgres types for inet/cidr/macaddr/macaddr8
https://www.postgresql.org/docs/14/datatype-net-types.html
I was poking at this but I have a few questions:
These data types are only built-in on PostgreSQL and appear to be supported by sqlx features ipnetwork, mac_address. I assume I have to add features to sea-query and sea-orm. I'm mainly just following the code for uuid.
Next, what's the general handling of sqllite / mysql databases that doesn't handle this type? Should we ignore it or try to serialize/deserialize to varchar or 32/48/128-bit integers?
postgres-types, a dependency of sea-query uses eui48, while sqlx uses mac_address to provide mac addresses. What relation does sea-query have to sqlx? I don't see any sqlx dependency in the query crate, but the ORM crate has a dependency on both sea-query and sqlx.
These data types are only built-in on PostgreSQL and appear to be supported by sqlx features
ipnetwork,mac_address. I assume I have to add features tosea-queryandsea-orm. I'm mainly just following the code foruuid.
Yes!
Next, what's the general handling of sqllite / mysql databases that doesn't handle this type? Should we ignore it or try to serialize/deserialize to varchar or 32/48/128-bit integers?
Serializing it to varchar (string) will be reasonable.
postgres-types, a dependency ofsea-queryuseseui48, whilesqlxusesmac_addressto provide mac addresses. What relation does sea-query have to sqlx? I don't see any sqlx dependency in the query crate, but the ORM crate has a dependency on both sea-query and sqlx.
Basically sea-query expose bind_params_sqlx_* macros for binding query & parameters generated by sea-query into SQLx query. So, sea-query doesn't requires any SQLx dependency.
@ajf @billy1624 I want to implement this if no one minds)
@ikrivosheev I have not started any work, feel free!
Thanks!! @ikrivosheev @ajf
I am working on PR.
https://github.com/SeaQL/sea-query/pull/309 - add support for sqlx. it remains to add support for postgres-types
Done: https://github.com/SeaQL/sea-query/pull/503