linkrs_query/executor/expression/functions/builtin/
geography.rs1pub mod constructors;
2pub mod measurements;
3pub mod predicates;
4pub mod serialization;
5pub mod transform;
6
7use self::constructors::*;
8use self::measurements::*;
9use self::predicates::*;
10use self::serialization::*;
11use self::transform::*;
12
13define_function_enum! {
14 pub enum GeographyFunction {
15 StPoint => {
16 name: "st_point",
17 arity: 2,
18 variadic: false,
19 description: "Create Geographic Points (Longitude, Latitude)",
20 handler: execute_st_point
21 },
22 StGeogFromText => {
23 name: "st_geogfromtext",
24 arity: 1,
25 variadic: false,
26 description: "Creating geographic objects from WKT text",
27 handler: execute_st_geogfromtext
28 },
29 StAsText => {
30 name: "st_astext",
31 arity: 1,
32 variadic: false,
33 description: "Convert geographic objects to WKT text",
34 handler: execute_st_astext
35 },
36 StCentroid => {
37 name: "st_centroid",
38 arity: 1,
39 variadic: false,
40 description: "Calculate the center point of a geographic object",
41 handler: execute_st_centroid
42 },
43 StIsValid => {
44 name: "st_isvalid",
45 arity: 1,
46 variadic: false,
47 description: "Checking the validity of geographic objects",
48 handler: execute_st_isvalid
49 },
50 StIntersects => {
51 name: "st_intersects",
52 arity: 2,
53 variadic: false,
54 description: "Check if two geographic objects intersect",
55 handler: execute_st_intersects
56 },
57 StCovers => {
58 name: "st_covers",
59 arity: 2,
60 variadic: false,
61 description: "Check if the first geographic object overrides the second",
62 handler: execute_st_covers
63 },
64 StCoveredBy => {
65 name: "st_coveredby",
66 arity: 2,
67 variadic: false,
68 description: "Check if the first geographic object is overwritten by the second",
69 handler: execute_st_coveredby
70 },
71 StDWithin => {
72 name: "st_dwithin",
73 arity: 3,
74 variadic: false,
75 description: "Check that two geographic objects are within the specified distance (in kilometers)",
76 handler: execute_st_dwithin
77 },
78 StDistance => {
79 name: "st_distance",
80 arity: 2,
81 variadic: false,
82 description: "Calculation of the distance between two geographical objects (in kilometers)",
83 handler: execute_st_distance
84 },
85 StArea => {
86 name: "st_area",
87 arity: 1,
88 variadic: false,
89 description: "Calculate the area of a polygon in square kilometers",
90 handler: execute_st_area
91 },
92 StLength => {
93 name: "st_length",
94 arity: 1,
95 variadic: false,
96 description: "Calculate the length of a linestring in kilometers",
97 handler: execute_st_length
98 },
99 StPerimeter => {
100 name: "st_perimeter",
101 arity: 1,
102 variadic: false,
103 description: "Calculate the perimeter of a polygon in kilometers",
104 handler: execute_st_perimeter
105 },
106 StNPoints => {
107 name: "st_npoints",
108 arity: 1,
109 variadic: false,
110 description: "Return the number of points in a geometry",
111 handler: execute_st_npoints
112 },
113 StStartPoint => {
114 name: "st_startpoint",
115 arity: 1,
116 variadic: false,
117 description: "Return the start point of a linestring",
118 handler: execute_st_startpoint
119 },
120 StEndPoint => {
121 name: "st_endpoint",
122 arity: 1,
123 variadic: false,
124 description: "Return the end point of a linestring",
125 handler: execute_st_endpoint
126 },
127 StIsRing => {
128 name: "st_isring",
129 arity: 1,
130 variadic: false,
131 description: "Check if a linestring is a ring",
132 handler: execute_st_isring
133 },
134 StIsClosed => {
135 name: "st_isclosed",
136 arity: 1,
137 variadic: false,
138 description: "Check if a linestring is closed",
139 handler: execute_st_isclosed
140 },
141 StGeometryType => {
142 name: "st_geometrytype",
143 arity: 1,
144 variadic: false,
145 description: "Return the geometry type name",
146 handler: execute_st_geometrytype
147 },
148 StContains => {
149 name: "st_contains",
150 arity: 2,
151 variadic: false,
152 description: "Check if geometry A contains geometry B",
153 handler: execute_st_contains
154 },
155 StWithin => {
156 name: "st_within",
157 arity: 2,
158 variadic: false,
159 description: "Check if geometry A is within geometry B",
160 handler: execute_st_within
161 },
162 StEnvelope => {
163 name: "st_envelope",
164 arity: 1,
165 variadic: false,
166 description: "Return the bounding box of a geometry as a polygon",
167 handler: execute_st_envelope
168 },
169 StBuffer => {
170 name: "st_buffer",
171 arity: 2,
172 variadic: false,
173 description: "Create a buffer around a geometry",
174 handler: execute_st_buffer
175 },
176 StBoundary => {
177 name: "st_boundary",
178 arity: 1,
179 variadic: false,
180 description: "Return the boundary of a geometry",
181 handler: execute_st_boundary
182 },
183 StCrosses => {
184 name: "st_crosses",
185 arity: 2,
186 variadic: false,
187 description: "Check if geometry A crosses geometry B",
188 handler: execute_st_crosses
189 },
190 StTouches => {
191 name: "st_touches",
192 arity: 2,
193 variadic: false,
194 description: "Check if geometry A touches geometry B",
195 handler: execute_st_touches
196 },
197 StOverlaps => {
198 name: "st_overlaps",
199 arity: 2,
200 variadic: false,
201 description: "Check if geometry A overlaps geometry B",
202 handler: execute_st_overlaps
203 },
204 StEquals => {
205 name: "st_equals",
206 arity: 2,
207 variadic: false,
208 description: "Check if two geometries are spatially equal",
209 handler: execute_st_equals
210 },
211 StAsGeoJson => {
212 name: "st_asgeojson",
213 arity: 1,
214 variadic: false,
215 description: "Convert geography to GeoJSON string",
216 handler: execute_st_asgeojson
217 },
218 StGeomFromGeoJson => {
219 name: "st_geomfromgeojson",
220 arity: 1,
221 variadic: false,
222 description: "Create geography from GeoJSON string",
223 handler: execute_st_geomfromgeojson
224 },
225 }
226}
227
228#[cfg(test)]
229mod test;