postgis_diesel/
sql_types.rs

1/// SQL type which may be used in table definition.
2/// ```
3///#[macro_use] extern crate diesel;
4///table! {
5///    use postgis_diesel::sql_types::*;
6///    use diesel::sql_types::*;
7///    geometry_example (id) {
8///        id -> Int4,
9///        point -> Nullable<Geometry>,
10///        linestring -> Geometry,
11///    }
12///}
13/// ```
14#[derive(Clone, Copy)]
15#[cfg_attr(feature = "diesel", derive(SqlType, QueryId))]
16#[cfg_attr(feature = "diesel", diesel(postgres_type(name = "geometry")))]
17pub struct Geometry;
18
19/// SQL type which may be used in table definition.
20/// ```
21///#[macro_use] extern crate diesel;
22///table! {
23///    use postgis_diesel::sql_types::*;
24///    use diesel::sql_types::*;
25///    geography_example (id) {
26///        id -> Int4,
27///        point -> Geography,
28///    }
29///}
30/// ```
31#[derive(Clone, Copy)]
32#[cfg_attr(feature = "diesel", derive(SqlType, QueryId))]
33#[cfg_attr(feature = "diesel", diesel(postgres_type(name = "geography")))]
34pub struct Geography;
35
36#[cfg(feature = "diesel")]
37pub trait GeoType: diesel::sql_types::SingleValue {}
38
39#[cfg(feature = "diesel")]
40impl GeoType for Geometry {}
41
42#[cfg(feature = "diesel")]
43impl GeoType for Geography {}