1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! SZ-ORM PostGIS Extension
//!
//! Provides PostgreSQL PostGIS spatial geometry query capabilities, supporting three implementations:
//!
//! - **In-memory implementation** (`Memory`): Pure Rust geometry computation, no database connection, suitable for testing and benchmarking
//! - **Stub implementation** (`Stub`): Generates PostGIS SQL string but does not execute, suitable for debugging
//! - **Real implementation** (`RealPg`, requires `real-postgis` feature): Connects to PostgreSQL via tokio-postgres
//!
//! # Supported Geometry Types
//!
//! - `Point`: Point
//! - `LineString`: Line string
//! - `Polygon`: Polygon (with holes)
//! - `MultiPoint` / `MultiLineString` / `MultiPolygon`: Multi-geometry
//!
//! All geometry types carry SRID (coordinate reference system ID), default WGS84 (SRID=4326).
//!
//! # Supported Spatial Operations
//!
//! | Method | SQL equivalent | Description |
//! |------|---------|------|
//! | `st_distance` | `ST_Distance` | Distance between two points |
//! | `st_contains` | `ST_Contains` | Contains check |
//! | `st_within` | `ST_Within` | Within check |
//! | `st_intersects` | `ST_Intersects` | Intersects check |
//! | `st_area` | `ST_Area` | Area calculation |
//! | `st_length` | `ST_Length` | Length calculation |
//! | `st_buffer` | `ST_Buffer` | Buffer zone |
//! | `st_union` | `ST_Union` | Geometry union |
//! | `add_geometry_column` | `AddGeometryColumn` | Add geometry column |
//! | `create_spatial_index` | `CREATE INDEX ... USING GIST` | Spatial index |
//!
//! # Quick Start
//!
//! ```rust
//! use sz_orm_postgis::{PostgisBuilder, PostgisExt, PostgisProvider, Geometry, Point};
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let wrapper = PostgisBuilder::new(PostgisProvider::Memory).build()?;
//!
//! let beijing = Geometry::Point(Point::new(116.404, 39.915));
//! let shanghai = Geometry::Point(Point::new(121.474, 31.230));
//!
//! let distance = wrapper.st_distance(&beijing, &shanghai).await?;
//! println!("distance: {:.2} m", distance);
//! # Ok(())
//! # }
//! ```
pub use PostgisError;
pub use ;
pub use ;
pub use ;
pub use RealPgConfig;
pub use RealPostgis;
pub use MemoryPostgis;
pub use StubPostgis;