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
use diesel::sql_types::SingleValue;
/// SQL type which may be used in table definition.
/// ```
///#[macro_use] extern crate diesel;
///table! {
/// use postgis_diesel::sql_types::*;
/// use diesel::sql_types::*;
/// geometry_example (id) {
/// id -> Int4,
/// point -> Nullable<Geometry>,
/// linestring -> Geometry,
/// }
///}
/// ```
#[derive(SqlType, QueryId)]
#[diesel(postgres_type(name = "geometry"))]
pub struct Geometry;
/// SQL type which may be used in table definition.
/// ```
///#[macro_use] extern crate diesel;
///table! {
/// use postgis_diesel::sql_types::*;
/// use diesel::sql_types::*;
/// geography_example (id) {
/// id -> Int4,
/// point -> Geography,
/// }
///}
/// ```
#[derive(SqlType, QueryId)]
#[diesel(postgres_type(name = "geography"))]
pub struct Geography;
pub trait GeoType: SingleValue {}
impl GeoType for Geometry {}
impl GeoType for Geography {}