use diesel::expression::{AsExpression, Expression};
use diesel::sql_types::{Double, Integer, Nullable};
use crate::diesel::functions;
use crate::diesel::types::Geometry;
pub trait GeometryExpressionMethods: Expression<SqlType = Nullable<Geometry>> + Sized {
fn st_astext(self) -> functions::st_astext<Self> {
functions::st_astext(self)
}
fn st_asewkt(self) -> functions::st_asewkt<Self> {
functions::st_asewkt(self)
}
fn st_asbinary(self) -> functions::st_asbinary<Self> {
functions::st_asbinary(self)
}
fn st_asewkb(self) -> functions::st_asewkb<Self> {
functions::st_asewkb(self)
}
fn st_asgeojson(self) -> functions::st_asgeojson<Self> {
functions::st_asgeojson(self)
}
fn st_makeline<T>(self, other: T) -> functions::st_makeline<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_makeline(self, other)
}
fn st_makepolygon(self) -> functions::st_makepolygon<Self> {
functions::st_makepolygon(self)
}
fn st_collect<T>(self, other: T) -> functions::st_collect<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_collect(self, other)
}
fn st_srid(self) -> functions::st_srid<Self> {
functions::st_srid(self)
}
fn st_setsrid<S>(self, srid: S) -> functions::st_setsrid<Self, S>
where
S: AsExpression<Integer>,
{
functions::st_setsrid(self, srid)
}
fn st_geometrytype(self) -> functions::st_geometrytype<Self> {
functions::st_geometrytype(self)
}
fn st_x(self) -> functions::st_x<Self> {
functions::st_x(self)
}
fn st_y(self) -> functions::st_y<Self> {
functions::st_y(self)
}
fn st_z(self) -> functions::st_z<Self> {
functions::st_z(self)
}
fn st_isempty(self) -> functions::st_isempty<Self> {
functions::st_isempty(self)
}
fn st_ndims(self) -> functions::st_ndims<Self> {
functions::st_ndims(self)
}
fn st_coorddim(self) -> functions::st_coorddim<Self> {
functions::st_coorddim(self)
}
fn st_zmflag(self) -> functions::st_zmflag<Self> {
functions::st_zmflag(self)
}
fn st_memsize(self) -> functions::st_memsize<Self> {
functions::st_memsize(self)
}
fn st_isvalid(self) -> functions::st_isvalid<Self> {
functions::st_isvalid(self)
}
fn st_isvalidreason(self) -> functions::st_isvalidreason<Self> {
functions::st_isvalidreason(self)
}
fn st_numpoints(self) -> functions::st_numpoints<Self> {
functions::st_numpoints(self)
}
fn st_npoints(self) -> functions::st_npoints<Self> {
functions::st_npoints(self)
}
fn st_numgeometries(self) -> functions::st_numgeometries<Self> {
functions::st_numgeometries(self)
}
fn st_numinteriorrings(self) -> functions::st_numinteriorrings<Self> {
functions::st_numinteriorrings(self)
}
fn st_numinteriorring(self) -> functions::st_numinteriorring<Self> {
functions::st_numinteriorring(self)
}
fn st_numrings(self) -> functions::st_numrings<Self> {
functions::st_numrings(self)
}
fn st_dimension(self) -> functions::st_dimension<Self> {
functions::st_dimension(self)
}
fn st_envelope(self) -> functions::st_envelope<Self> {
functions::st_envelope(self)
}
fn st_pointn<S>(self, n: S) -> functions::st_pointn<Self, S>
where
S: AsExpression<Integer>,
{
functions::st_pointn(self, n)
}
fn st_startpoint(self) -> functions::st_startpoint<Self> {
functions::st_startpoint(self)
}
fn st_endpoint(self) -> functions::st_endpoint<Self> {
functions::st_endpoint(self)
}
fn st_exteriorring(self) -> functions::st_exteriorring<Self> {
functions::st_exteriorring(self)
}
fn st_interiorringn<S>(self, n: S) -> functions::st_interiorringn<Self, S>
where
S: AsExpression<Integer>,
{
functions::st_interiorringn(self, n)
}
fn st_geometryn<S>(self, n: S) -> functions::st_geometryn<Self, S>
where
S: AsExpression<Integer>,
{
functions::st_geometryn(self, n)
}
fn st_xmin(self) -> functions::st_xmin<Self> {
functions::st_xmin(self)
}
fn st_xmax(self) -> functions::st_xmax<Self> {
functions::st_xmax(self)
}
fn st_ymin(self) -> functions::st_ymin<Self> {
functions::st_ymin(self)
}
fn st_ymax(self) -> functions::st_ymax<Self> {
functions::st_ymax(self)
}
fn st_area(self) -> functions::st_area<Self> {
functions::st_area(self)
}
fn st_length(self) -> functions::st_length<Self> {
functions::st_length(self)
}
fn st_length2d(self) -> functions::st_length2d<Self> {
functions::st_length2d(self)
}
fn st_perimeter(self) -> functions::st_perimeter<Self> {
functions::st_perimeter(self)
}
fn st_perimeter2d(self) -> functions::st_perimeter2d<Self> {
functions::st_perimeter2d(self)
}
fn st_distance<T>(self, other: T) -> functions::st_distance<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_distance(self, other)
}
fn st_distancesphere<T>(self, other: T) -> functions::st_distancesphere<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_distancesphere(self, other)
}
fn st_distancespheroid<T>(self, other: T) -> functions::st_distancespheroid<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_distancespheroid(self, other)
}
fn st_hausdorffdistance<T>(self, other: T) -> functions::st_hausdorffdistance<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_hausdorffdistance(self, other)
}
fn st_centroid(self) -> functions::st_centroid<Self> {
functions::st_centroid(self)
}
fn st_pointonsurface(self) -> functions::st_pointonsurface<Self> {
functions::st_pointonsurface(self)
}
fn st_union<T>(self, other: T) -> functions::st_union<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_union(self, other)
}
fn st_intersection<T>(self, other: T) -> functions::st_intersection<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_intersection(self, other)
}
fn st_difference<T>(self, other: T) -> functions::st_difference<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_difference(self, other)
}
fn st_symdifference<T>(self, other: T) -> functions::st_symdifference<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_symdifference(self, other)
}
fn st_buffer<D>(self, distance: D) -> functions::st_buffer<Self, D>
where
D: AsExpression<Double>,
{
functions::st_buffer(self, distance)
}
fn st_intersects<T>(self, other: T) -> functions::st_intersects<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_intersects(self, other)
}
fn st_contains<T>(self, other: T) -> functions::st_contains<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_contains(self, other)
}
fn st_within<T>(self, other: T) -> functions::st_within<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_within(self, other)
}
fn inside_area<T>(self, area: T) -> functions::inside_area<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::inside_area(self, area)
}
fn st_covers<T>(self, other: T) -> functions::st_covers<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_covers(self, other)
}
fn st_coveredby<T>(self, other: T) -> functions::st_coveredby<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_coveredby(self, other)
}
fn st_disjoint<T>(self, other: T) -> functions::st_disjoint<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_disjoint(self, other)
}
fn outside_area<T>(self, area: T) -> functions::outside_area<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::outside_area(self, area)
}
fn st_equals<T>(self, other: T) -> functions::st_equals<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_equals(self, other)
}
fn st_dwithin<T, D>(self, other: T, distance: D) -> functions::st_dwithin<Self, T, D>
where
T: AsExpression<Nullable<Geometry>>,
D: AsExpression<Double>,
{
functions::st_dwithin(self, other, distance)
}
fn st_dwithinsphere<T, D>(
self,
other: T,
distance: D,
) -> functions::st_dwithinsphere<Self, T, D>
where
T: AsExpression<Nullable<Geometry>>,
D: AsExpression<Double>,
{
functions::st_dwithinsphere(self, other, distance)
}
fn st_dwithinspheroid<T, D>(
self,
other: T,
distance: D,
) -> functions::st_dwithinspheroid<Self, T, D>
where
T: AsExpression<Nullable<Geometry>>,
D: AsExpression<Double>,
{
functions::st_dwithinspheroid(self, other, distance)
}
fn st_touches<T>(self, other: T) -> functions::st_touches<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_touches(self, other)
}
fn st_crosses<T>(self, other: T) -> functions::st_crosses<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_crosses(self, other)
}
fn st_overlaps<T>(self, other: T) -> functions::st_overlaps<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_overlaps(self, other)
}
fn st_relate<T>(self, other: T) -> functions::st_relate<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_relate(self, other)
}
fn st_relate_match_geoms<T, P>(
self,
other: T,
pattern: P,
) -> functions::st_relate_match_geoms<Self, T, P>
where
T: AsExpression<Nullable<Geometry>>,
P: AsExpression<diesel::sql_types::Text>,
{
functions::st_relate_match_geoms(self, other, pattern)
}
fn st_lengthsphere(self) -> functions::st_lengthsphere<Self> {
functions::st_lengthsphere(self)
}
fn st_azimuth<T>(self, target: T) -> functions::st_azimuth<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_azimuth(self, target)
}
fn st_project<D, A>(self, distance: D, azimuth: A) -> functions::st_project<Self, D, A>
where
D: AsExpression<Double>,
A: AsExpression<Double>,
{
functions::st_project(self, distance, azimuth)
}
fn st_closestpoint<T>(self, other: T) -> functions::st_closestpoint<Self, T>
where
T: AsExpression<Nullable<Geometry>>,
{
functions::st_closestpoint(self, other)
}
}
impl<E> GeometryExpressionMethods for E where E: Expression<SqlType = Nullable<Geometry>> + Sized {}