Skip to content

Commit abaab11

Browse files
updated semantics
1 parent 986a2f2 commit abaab11

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

templates/deno/src/query.ts.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export class Query {
207207
* @returns {string}
208208
*/
209209
static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
210-
new Query("distanceEqual", attribute, [values, distance, meters]).toString();
210+
new Query("distanceEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
211211

212212
/**
213213
* Filter resources where attribute is not at a specific distance from the given coordinates.
@@ -219,7 +219,7 @@ export class Query {
219219
* @returns {string}
220220
*/
221221
static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
222-
new Query("distanceNotEqual", attribute, [values, distance, meters]).toString();
222+
new Query("distanceNotEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
223223

224224
/**
225225
* Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
@@ -231,7 +231,7 @@ export class Query {
231231
* @returns {string}
232232
*/
233233
static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
234-
new Query("distanceGreaterThan", attribute, [values, distance, meters]).toString();
234+
new Query("distanceGreaterThan", attribute, [values, distance, meters] as QueryTypesList).toString();
235235

236236
/**
237237
* Filter resources where attribute is at a distance less than the specified value from the given coordinates.
@@ -243,7 +243,7 @@ export class Query {
243243
* @returns {string}
244244
*/
245245
static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
246-
new Query("distanceLessThan", attribute, [values, distance, meters]).toString();
246+
new Query("distanceLessThan", attribute, [values, distance, meters] as QueryTypesList).toString();
247247

248248
/**
249249
* Filter resources where attribute intersects with the given geometry.

templates/dotnet/Package/Query.cs.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,22 +204,22 @@ namespace {{ spec.title | caseUcfirst }}
204204

205205
public static string DistanceEqual(string attribute, List<object> values, double distance, bool meters = false)
206206
{
207-
return new Query("distanceEqual", attribute, new List<object> { new List<object> { values, distance, meters } }).ToString();
207+
return new Query("distanceEqual", attribute, new List<object> { values, distance, meters }).ToString();
208208
}
209209

210210
public static string DistanceNotEqual(string attribute, List<object> values, double distance, bool meters = false)
211211
{
212-
return new Query("distanceNotEqual", attribute, new List<object> { new List<object> { values, distance, meters } }).ToString();
212+
return new Query("distanceNotEqual", attribute, new List<object> { values, distance, meters }).ToString();
213213
}
214214

215215
public static string DistanceGreaterThan(string attribute, List<object> values, double distance, bool meters = false)
216216
{
217-
return new Query("distanceGreaterThan", attribute, new List<object> { new List<object> { values, distance, meters } }).ToString();
217+
return new Query("distanceGreaterThan", attribute, new List<object> { values, distance, meters }).ToString();
218218
}
219219

220220
public static string DistanceLessThan(string attribute, List<object> values, double distance, bool meters = false)
221221
{
222-
return new Query("distanceLessThan", attribute, new List<object> { new List<object> { values, distance, meters } }).ToString();
222+
return new Query("distanceLessThan", attribute, new List<object> { values, distance, meters }).ToString();
223223
}
224224

225225
public static string Intersects(string attribute, List<object> values)

templates/react-native/src/query.ts.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class Query {
204204
* @returns {string}
205205
*/
206206
static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
207-
new Query("distanceEqual", attribute, [values, distance, meters]).toString();
207+
new Query("distanceEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
208208

209209
/**
210210
* Filter resources where attribute is not at a specific distance from the given coordinates.
@@ -216,7 +216,7 @@ export class Query {
216216
* @returns {string}
217217
*/
218218
static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
219-
new Query("distanceNotEqual", attribute, [values, distance, meters]).toString();
219+
new Query("distanceNotEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
220220

221221
/**
222222
* Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
@@ -228,7 +228,7 @@ export class Query {
228228
* @returns {string}
229229
*/
230230
static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
231-
new Query("distanceGreaterThan", attribute, [values, distance, meters]).toString();
231+
new Query("distanceGreaterThan", attribute, [values, distance, meters] as QueryTypesList).toString();
232232

233233
/**
234234
* Filter resources where attribute is at a distance less than the specified value from the given coordinates.
@@ -240,7 +240,7 @@ export class Query {
240240
* @returns {string}
241241
*/
242242
static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
243-
new Query("distanceLessThan", attribute, [values, distance, meters]).toString();
243+
new Query("distanceLessThan", attribute, [values, distance, meters] as QueryTypesList).toString();
244244

245245
/**
246246
* Filter resources where attribute intersects with the given geometry.

templates/swift/Sources/Query.swift.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public struct Query : Codable, CustomStringConvertible {
8585
return [.bool(boolValue)]
8686
case let queryValue as Query:
8787
return [.query(queryValue)]
88+
case let anyArray as [Any]:
89+
return anyArray.flatMap { convertToQueryValueArray($0) ?? [] }
8890
default:
8991
return nil
9092
}

templates/web/src/query.ts.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ export class Query {
357357
* @returns {string}
358358
*/
359359
static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
360-
new Query("distanceEqual", attribute, [values, distance, meters]).toString();
360+
new Query("distanceEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
361361

362362
/**
363363
* Filter resources where attribute is not at a specific distance from the given coordinates.
@@ -369,7 +369,7 @@ export class Query {
369369
* @returns {string}
370370
*/
371371
static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
372-
new Query("distanceNotEqual", attribute, [values, distance, meters]).toString();
372+
new Query("distanceNotEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
373373

374374
/**
375375
* Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
@@ -381,7 +381,7 @@ export class Query {
381381
* @returns {string}
382382
*/
383383
static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
384-
new Query("distanceGreaterThan", attribute, [values, distance, meters]).toString();
384+
new Query("distanceGreaterThan", attribute, [values, distance, meters] as QueryTypesList).toString();
385385

386386
/**
387387
* Filter resources where attribute is at a distance less than the specified value from the given coordinates.
@@ -393,7 +393,7 @@ export class Query {
393393
* @returns {string}
394394
*/
395395
static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = false): string =>
396-
new Query("distanceLessThan", attribute, [values, distance, meters]).toString();
396+
new Query("distanceLessThan", attribute, [values, distance, meters] as QueryTypesList).toString();
397397

398398
/**
399399
* Filter resources where attribute intersects with the given geometry.

tests/languages/ruby/tests.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@
159159
puts Query.updated_before("2023-01-01")
160160
puts Query.updated_after("2023-01-01")
161161

162-
puts Query.or([Query.equal("released", true), Query.less_than("releasedYear", 1990)])
163-
puts Query.and([Query.equal("released", false), Query.greater_than("releasedYear", 2015)])
164-
165162
# Spatial Distance query tests
166163
puts Query.distance_equal("location", [40.7128, -74], 1000)
167164
puts Query.distance_equal("location", [40.7128, -74], 1000, true)
@@ -182,6 +179,9 @@
182179
puts Query.touches("location", [40.7128, -74])
183180
puts Query.not_touches("location", [40.7128, -74])
184181

182+
puts Query.or([Query.equal("released", true), Query.less_than("releasedYear", 1990)])
183+
puts Query.and([Query.equal("released", false), Query.greater_than("releasedYear", 2015)])
184+
185185
# Permission & Role helper tests
186186
puts Permission.read(Role.any())
187187
puts Permission.write(Role.user(ID.custom('userid')))

0 commit comments

Comments
 (0)