feat: add GeozeroGeometry and FromWkb support for postgis_diesel types#284
Open
georgeboot wants to merge 4 commits intogeorust:mainfrom
Open
feat: add GeozeroGeometry and FromWkb support for postgis_diesel types#284georgeboot wants to merge 4 commits intogeorust:mainfrom
georgeboot wants to merge 4 commits intogeorust:mainfrom
Conversation
78a5fdd to
d8125ea
Compare
Bridge postgis_diesel geometry types with geozero's trait system, enabling zero-copy conversion between postgis_diesel and any format geozero supports (GeoJSON, WKT, WKB, SVG, geo-types, etc.). - Implement GeozeroGeometry for all postgis_diesel types (Point, PointZ, PointM, PointZM, AnyPoint, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryCollection, GeometryContainer) - Add PostgisDieselWriter GeomProcessor for building postgis_diesel types from any geozero source - Implement FromWkb for GeometryContainer<P> for all point types - Add wkb::Decode<T>/wkb::Encode<T> Diesel FromSql/ToSql impls - Add impl_diesel_postgis_decode!/impl_diesel_postgis_encode! macros - Preserve existing Ewkb<B> Diesel impls for backwards compatibility
d8125ea to
f47336b
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GeozeroGeometryfor allpostgis_dieseltypes (Point,PointZ,PointM,PointZM,AnyPoint,LineString<P>,Polygon<P>,MultiPoint<P>,MultiLineString<P>,MultiPolygon<P>,GeometryCollection<P>,GeometryContainer<P>), enabling conversion to any geozero-supported format (GeoJSON, WKT, WKB, SVG, geo-types, etc.)PostgisDieselWriter(GeomProcessor) andFromWkbforGeometryContainer<P>, enabling construction of postgis_diesel types from any geozero sourcewkb::Decode<T>/wkb::Encode<T>DieselFromSql/ToSqlimpls andimpl_diesel_postgis_decode!/impl_diesel_postgis_encode!macros (mirroring existing postgres/sqlx patterns)Ewkb<B>Diesel impls andsql_typesare preservedMotivation
The existing
with-postgis-dieselfeature only provided rawEwkb<Vec<u8>>support — opaque WKB bytes with no typed geometry conversion. This meant downstream users had to write hundreds of lines of manual conversion code to bridge postgis_diesel geometries with other formats.This PR brings the diesel integration to parity with the existing postgres and sqlx integrations, which already have full
GeozeroGeometry/FromWkbsupport viawkb::Encode<T>/wkb::Decode<T>.Test plan
cargo clippyclean,cargo test -p geozeropasses, all existing tests unaffectedwith-postgis-diesel,with-postgis-postgres,with-postgis-sqlx)