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
//! Decode adapter for PostGIS `geography`/`geometry` columns
//! (cratestack#842).
//!
//! Binding is symmetric-free: PostGIS registers an implicit cast from
//! `bytea`, so `push_bind_value` sends a plain `Vec<u8>` and Postgres
//! coerces it (see `query::support::values`). **Decoding is not** —
//! coming out of the database the column's type OID is `geography`'s
//! (or `geometry`'s), and sqlx type-checks the OID against the Rust
//! type before handing over the bytes. A bare `Vec<u8>` therefore
//! fails with "mismatched types; Rust type `Vec<u8>` is not compatible
//! with SQL type `geography`" even though the payload is exactly the
//! bytes we want.
//!
//! [`Ewkb`] exists to satisfy that check: it declares itself compatible
//! with both spatial type names and then hands back the raw bytes
//! unchanged. Same pattern, and same reason, as `pgvector::Vector` —
//! the public generated struct field stays a plain `Vec<u8>` and this
//! type only appears at the row-decode boundary.
//!
//! The payload is EWKB, PostGIS's binary wire format — verified
//! against postgis/postgis:16-3.4, where
//! `ST_AsEWKB(col::geometry) = col::bytea` holds.
use Decode;
use BoxDynError;
use TypeInfo as _;
use Type;
use ;
/// Raw EWKB bytes read from a `geography`/`geometry` column.
;