diesel_mysql_spatial/
functions.rs

1#![allow(non_snake_case)]
2use super::sql_types::*;
3use diesel::sql_types::*;
4
5sql_function! {
6	/// Represents the MySQL `ST_Dimension` function.
7	#[sql_name="ST_Dimension"]
8	fn ST_Dimension<G: Into<Geometry>>(g: G) -> Integer;
9}
10
11sql_function! {
12	/// Represents the MySQL `ST_Envelope` function.
13	#[sql_name="ST_Envelope"]
14	fn ST_Envelope<G: Into<Geometry>>(g: G) -> Polygon;
15}
16
17sql_function! {
18	/// Represents the MySQL `ST_GeometryType` function.
19	#[sql_name="ST_GeometryType"]
20	fn ST_GeometryType<G: Into<Geometry>>(g: G) -> Text;
21}
22
23sql_function! {
24	/// Represents the MySQL `ST_IsEmpty` function.
25	#[sql_name="ST_IsEmpty"]
26	fn ST_IsEmpty<G: Into<Geometry>>(g: G) -> Bool;
27}
28
29sql_function! {
30	/// Represents the MySQL `ST_IsSimple` function.
31	#[sql_name="ST_IsSimple"]
32	fn ST_IsSimple<G: Into<Geometry>>(g: G) -> Bool;
33}
34
35sql_function! {
36	/// Represents the MySQL `ST_SRID` function (with one argument).
37	#[sql_name="ST_SRID"]
38	fn ST_SRID<G: Into<Geometry>>(g: G) -> Integer;
39}
40
41sql_function! {
42	/// Represents the MySQL `ST_SRID` function (with two arguments).
43	#[sql_name="ST_SRID"]
44	fn ST_SRID_2<G: Into<Geometry>>(g: G, srid: Integer) -> G;
45}
46
47sql_function! {
48	/// Represents the MySQL `ST_Transform` function.
49	#[sql_name="ST_Transform"]
50	fn ST_Transform<G: Into<Geometry>>(g: G, target_srid: Integer) -> G;
51}
52
53sql_function! {
54	/// Represents the MySQL `ST_Latitude` function (with one argument).
55	#[sql_name="ST_Latitude"]
56	fn ST_Latitude(p: Point) -> Double;
57}
58
59sql_function! {
60	/// Represents the MySQL `ST_Longitude` function (with one argument).
61	#[sql_name="ST_Longitude"]
62	fn ST_Longitude(p: Point) -> Double;
63}
64
65sql_function! {
66	/// Represents the MySQL `ST_Latitude` function (with two arguments).
67	#[sql_name="ST_Latitude"]
68	fn ST_Latitude_2(p: Point, new_latitude: Double) -> Point;
69}
70
71sql_function! {
72	/// Represents the MySQL `ST_Longitude` function (with two arguments).
73	#[sql_name="ST_Longitude"]
74	fn ST_Longitude_2(p: Point, new_longitude: Double) -> Point;
75}
76
77sql_function! {
78	/// Represents the MySQL `ST_X` function (with one argument).
79	#[sql_name="ST_X"]
80	fn ST_X(p: Point) -> Double;
81}
82
83sql_function! {
84	/// Represents the MySQL `ST_Y` function (with one argument).
85	#[sql_name="ST_Y"]
86	fn ST_Y(p: Point) -> Double;
87}
88
89sql_function! {
90	/// Represents the MySQL `ST_X` function (with two arguments).
91	#[sql_name="ST_X"]
92	fn ST_X_2(p: Point, new_x: Double) -> Point;
93}
94
95sql_function! {
96	/// Represents the MySQL `ST_Y` function (with two arguments).
97	#[sql_name="ST_Y"]
98	fn ST_Y_2(p: Point, new_y: Double) -> Point;
99}
100
101sql_function! {
102	/// Represents the MySQL `ST_EndPoint` function
103	#[sql_name="ST_EndPoint"]
104	fn ST_EndPoint(ls: LineString) -> Point;
105}
106
107sql_function! {
108	/// Represents the MySQL `ST_IsClosed` function
109	#[sql_name="ST_IsClosed"]
110	fn ST_IsClosed<G: Into<Geometry>>(ls: G) -> Bool;
111}
112
113sql_function! {
114	/// Represents the MySQL `ST_Length` function
115	#[sql_name="ST_Length"]
116	fn ST_Length<G: Into<Geometry>>(ls: G) -> Double;
117}
118
119sql_function! {
120	/// Represents the MySQL `ST_NumPoints` function
121	#[sql_name="ST_NumPoints"]
122	fn ST_NumPoints(ls: LineString) -> Integer;
123}
124
125sql_function! {
126	/// Represents the MySQL `ST_PointN` function
127	#[sql_name="ST_PointN"]
128	fn ST_PointN(ls: LineString, n: Integer) -> Nullable<Point>;
129}
130
131sql_function! {
132	/// Represents the MySQL `ST_StartPoint` function
133	#[sql_name="ST_StartPoint"]
134	fn ST_StartPoint(ls: LineString) -> Point;
135}
136
137sql_function! {
138	/// Represents the MySQL `ST_Area` function
139	#[sql_name="ST_Area"]
140	fn ST_Area<G: Into<Geometry>>(poly: G) -> Double;
141}
142
143sql_function! {
144	/// Represents the MySQL `ST_Centroid` function
145	#[sql_name="ST_Centroid"]
146	fn ST_Centroid<G: Into<Geometry>>(poly: G) -> Nullable<Point>;
147}
148
149sql_function! {
150	/// Represents the MySQL `ST_ExteriorRing` function
151	#[sql_name="ST_ExteriorRing"]
152	fn ST_ExteriorRing(poly: Polygon) -> LineString;
153}
154
155sql_function! {
156	/// Represents the MySQL `ST_ExteriorRing` function
157	#[sql_name="ST_InteriorRingN"]
158	fn ST_InteriorRingN(poly: Polygon, n: Integer) -> Nullable<LineString>;
159}
160
161sql_function! {
162	/// Represents the MySQL `ST_NumInteriorRings` function
163	#[sql_name="ST_NumInteriorRings"]
164	fn ST_NumInteriorRings(poly: Polygon) -> Integer;
165}
166
167sql_function! {
168	/// Represents the MySQL `ST_GeometryN` function
169	#[sql_name="ST_GeometryN"]
170	fn ST_GeometryN(gc: GeometryCollection, n: Integer) -> Nullable<Geometry>;
171}
172
173sql_function! {
174	/// Represents the MySQL `ST_NumGeometries` function
175	#[sql_name="ST_NumGeometries"]
176	fn ST_NumGeometries(gc: GeometryCollection) -> Integer;
177}
178
179sql_function! {
180	/// Represents the MySQL `ST_Buffer_Strategy` function (with one argument)
181	#[sql_name="ST_Buffer_Strategy"]
182	fn ST_Buffer_Strategy(strategy: Text) -> Blob;
183}
184
185sql_function! {
186	/// Represents the MySQL `ST_Buffer_Strategy` function (with two arguments)
187	#[sql_name="ST_Buffer_Strategy"]
188	fn ST_Buffer_Strategy_2(strategy: Text, points_per_circle: Integer) -> Blob;
189}
190
191sql_function! {
192	/// Represents the MySQL `ST_Buffer` function (with two arguments)
193	#[sql_name="ST_Buffer"]
194	fn ST_Buffer<G: Into<Geometry>>(g: G, d: Double) -> Geometry;
195}
196
197sql_function! {
198	/// Represents the MySQL `ST_Buffer` function (with three arguments)
199	#[sql_name="ST_Buffer"]
200	fn ST_Buffer_1<G: Into<Geometry>>(g: G, d: Double, strategy1: Blob) -> Geometry;
201}
202
203sql_function! {
204	/// Represents the MySQL `ST_Buffer` function (with four arguments)
205	#[sql_name="ST_Buffer"]
206	fn ST_Buffer_2<G: Into<Geometry>>(g: G, d: Double, strategy1: Blob, strategy2: Blob) -> Geometry;
207}
208
209sql_function! {
210	/// Represents the MySQL `ST_Buffer` function (with five arguments)
211	#[sql_name="ST_Buffer"]
212	fn ST_Buffer_3<G: Into<Geometry>>(g: G, d: Double, strategy1: Blob, strategy2: Blob, strategy3: Blob) -> Geometry;
213}
214
215sql_function! {
216	/// Represents the MySQL `ST_ConvexHull` function
217	#[sql_name="ST_ConvexHull"]
218	fn ST_ConvexHull<G: Into<Geometry>>(g: G) -> Nullable<Geometry>;
219}
220
221sql_function! {
222	/// Represents the MySQL `ST_Difference` function
223	#[sql_name="ST_Difference"]
224	fn ST_Difference<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Geometry;
225}
226
227sql_function! {
228	/// Represents the MySQL `ST_Intersection` function
229	#[sql_name="ST_Intersection"]
230	fn ST_Intersection<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Geometry;
231}
232
233sql_function! {
234	/// Represents the MySQL `ST_SymDifference` function
235	#[sql_name="ST_SymDifference"]
236	fn ST_SymDifference<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Geometry;
237}
238
239sql_function! {
240	/// Represents the MySQL `ST_Union` function
241	#[sql_name="ST_Union"]
242	fn ST_Union<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Geometry;
243}
244
245sql_function! {
246	/// Represents the MySQL `ST_LineInterpolatePoint` function
247	#[sql_name="ST_LineInterpolatePoint"]
248	fn ST_LineInterpolatePoint(ls: LineString, fractional_distance: Double) -> Point;
249}
250
251sql_function! {
252	/// Represents the MySQL `ST_LineInterpolatePoints` function
253	#[sql_name="ST_LineInterpolatePoints"]
254	fn ST_LineInterpolatePoints(ls: LineString, fractional_distance: Double) -> MultiPoint;
255}
256
257sql_function! {
258	/// Represents the MySQL `ST_PointAtDistance` function
259	#[sql_name="ST_PointAtDistance"]
260	fn ST_PointAtDistance(ls: LineString, distance: Double) -> Point;
261}
262
263sql_function! {
264	/// Represents the MySQL `ST_Contains` function
265	#[sql_name="ST_Contains"]
266	fn ST_Contains<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
267}
268
269sql_function! {
270	/// Represents the MySQL `ST_Crosses` function
271	#[sql_name="ST_Crosses"]
272	fn ST_Crosses<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
273}
274
275sql_function! {
276	/// Represents the MySQL `ST_Disjoint` function
277	#[sql_name="ST_Disjoint"]
278	fn ST_Disjoint<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
279}
280
281sql_function! {
282	/// Represents the MySQL `ST_Distance` function
283	#[sql_name="ST_Distance"]
284	fn ST_Distance<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Double;
285}
286
287sql_function! {
288	/// Represents the MySQL `ST_Equals` function
289	#[sql_name="ST_Equals"]
290	fn ST_Equals<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
291}
292
293sql_function! {
294	/// Represents the MySQL `ST_Intersects` function
295	#[sql_name="ST_Intersects"]
296	fn ST_Intersects<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
297}
298
299sql_function! {
300	/// Represents the MySQL `ST_Overlaps` function
301	#[sql_name="ST_Overlaps"]
302	fn ST_Overlaps<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Nullable<Bool>;
303}
304
305sql_function! {
306	/// Represents the MySQL `ST_Touches` function
307	#[sql_name="ST_Touches"]
308	fn ST_Touches<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Nullable<Bool>;
309}
310
311sql_function! {
312	/// Represents the MySQL `ST_Within` function
313	#[sql_name="ST_Within"]
314	fn ST_Within<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
315}
316
317sql_function! {
318	/// Represents the MySQL `MBRContains` function
319	#[sql_name="MBRContains"]
320	fn MBRContains<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
321}
322
323sql_function! {
324	/// Represents the MySQL `MBRCoveredBy` function
325	#[sql_name="MBRCoveredBy"]
326	fn MBRCoveredBy<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
327}
328
329sql_function! {
330	/// Represents the MySQL `MBRCovers` function
331	#[sql_name="MBRCovers"]
332	fn MBRCovers<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
333}
334
335sql_function! {
336	/// Represents the MySQL `MBRDisjoint` function
337	#[sql_name="MBRDisjoint"]
338	fn MBRDisjoint<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
339}
340
341sql_function! {
342	/// Represents the MySQL `MBRDisjoint` function
343	#[sql_name="MBREquals"]
344	fn MBREquals<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
345}
346
347sql_function! {
348	/// Represents the MySQL `MBROverlaps` function
349	#[sql_name="MBROverlaps"]
350	fn MBROverlaps<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
351}
352
353sql_function! {
354	/// Represents the MySQL `MBRTouches` function
355	#[sql_name="MBRTouches"]
356	fn MBRTouches<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
357}
358
359sql_function! {
360	/// Represents the MySQL `MBRTouches` function
361	#[sql_name="MBRWithin"]
362	fn MBRWithin<G1: Into<Geometry>, G2: Into<Geometry>>(g1: G1, g2: G2) -> Bool;
363}
364
365sql_function! {
366	/// Represents the MySQL `ST_Collect` aggregate function
367	#[aggregate]
368	#[sql_name = "ST_Collect"]
369	fn ST_Collect<G: Into<Geometry>>(expr: G) -> Geometry;
370}
371
372sql_function! {
373	/// Represents the MySQL `ST_IsValid` function
374	#[sql_name = "ST_IsValid"]
375	fn ST_IsValid<G: Into<Geometry>>(expr: G) -> Bool;
376}
377
378sql_function! {
379	/// Represents the MySQL `ST_Validate` function
380	#[sql_name = "ST_Validate"]
381	fn ST_Validate<G: Into<Geometry> + NotNull>(expr: G) -> Nullable<G>;
382}