@@ -188,7 +188,7 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
188
188
* @param column The column to filter on.
189
189
* @param value The value to filter with.
190
190
*/
191
- cs ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
191
+ contains ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
192
192
if ( typeof value === 'string' ) {
193
193
// range types can be inclusive '[', ']' or exclusive '(', ')' so just
194
194
// keep it simple and accept a string
@@ -203,14 +203,17 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
203
203
return this
204
204
}
205
205
206
+ /** @deprecated Use `contains()` instead. */
207
+ cs = this . contains
208
+
206
209
/**
207
210
* Finds all rows whose json, array, or range value on the stated `column` is
208
211
* contained by the specified `value`.
209
212
*
210
213
* @param column The column to filter on.
211
214
* @param value The value to filter with.
212
215
*/
213
- cd ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
216
+ containedBy ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
214
217
if ( typeof value === 'string' ) {
215
218
// range
216
219
this . url . searchParams . append ( `${ column } ` , `cd.${ value } ` )
@@ -224,74 +227,92 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
224
227
return this
225
228
}
226
229
230
+ /** @deprecated Use `containedBy()` instead. */
231
+ cd = this . containedBy
232
+
227
233
/**
228
234
* Finds all rows whose range value on the stated `column` is strictly to the
229
235
* left of the specified `range`.
230
236
*
231
237
* @param column The column to filter on.
232
238
* @param range The range to filter with.
233
239
*/
234
- sl ( column : keyof T , range : string ) : this {
240
+ rangeLt ( column : keyof T , range : string ) : this {
235
241
this . url . searchParams . append ( `${ column } ` , `sl.${ range } ` )
236
242
return this
237
243
}
238
244
245
+ /** @deprecated Use `rangeLt()` instead. */
246
+ sl = this . rangeLt
247
+
239
248
/**
240
249
* Finds all rows whose range value on the stated `column` is strictly to
241
250
* the right of the specified `range`.
242
251
*
243
252
* @param column The column to filter on.
244
253
* @param range The range to filter with.
245
254
*/
246
- sr ( column : keyof T , range : string ) : this {
255
+ rangeGt ( column : keyof T , range : string ) : this {
247
256
this . url . searchParams . append ( `${ column } ` , `sr.${ range } ` )
248
257
return this
249
258
}
250
259
260
+ /** @deprecated Use `rangeGt()` instead. */
261
+ sr = this . rangeGt
262
+
251
263
/**
252
264
* Finds all rows whose range value on the stated `column` does not extend
253
265
* to the left of the specified `range`.
254
266
*
255
267
* @param column The column to filter on.
256
268
* @param range The range to filter with.
257
269
*/
258
- nxl ( column : keyof T , range : string ) : this {
270
+ rangeGte ( column : keyof T , range : string ) : this {
259
271
this . url . searchParams . append ( `${ column } ` , `nxl.${ range } ` )
260
272
return this
261
273
}
262
274
275
+ /** @deprecated Use `rangeGte()` instead. */
276
+ nxl = this . rangeGte
277
+
263
278
/**
264
279
* Finds all rows whose range value on the stated `column` does not extend
265
280
* to the right of the specified `range`.
266
281
*
267
282
* @param column The column to filter on.
268
283
* @param range The range to filter with.
269
284
*/
270
- nxr ( column : keyof T , range : string ) : this {
285
+ rangeLte ( column : keyof T , range : string ) : this {
271
286
this . url . searchParams . append ( `${ column } ` , `nxr.${ range } ` )
272
287
return this
273
288
}
274
289
290
+ /** @deprecated Use `rangeLte()` instead. */
291
+ nxr = this . rangeLte
292
+
275
293
/**
276
294
* Finds all rows whose range value on the stated `column` is adjacent to
277
295
* the specified `range`.
278
296
*
279
297
* @param column The column to filter on.
280
298
* @param range The range to filter with.
281
299
*/
282
- adj ( column : keyof T , range : string ) : this {
300
+ rangeAdjacent ( column : keyof T , range : string ) : this {
283
301
this . url . searchParams . append ( `${ column } ` , `adj.${ range } ` )
284
302
return this
285
303
}
286
304
305
+ /** @deprecated Use `rangeAdjacent()` instead. */
306
+ adj = this . rangeAdjacent
307
+
287
308
/**
288
- * Finds all rows whose array or range value on the stated `column` is
289
- * contained by the specified `value`.
309
+ * Finds all rows whose array or range value on the stated `column` overlaps
310
+ * (has a value in common) with the specified `value`.
290
311
*
291
312
* @param column The column to filter on.
292
313
* @param value The value to filter with.
293
314
*/
294
- ov ( column : keyof T , value : string | T [ keyof T ] [ ] ) : this {
315
+ overlaps ( column : keyof T , value : string | T [ keyof T ] [ ] ) : this {
295
316
if ( typeof value === 'string' ) {
296
317
// range
297
318
this . url . searchParams . append ( `${ column } ` , `ov.${ value } ` )
@@ -302,13 +323,48 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
302
323
return this
303
324
}
304
325
326
+ /** @deprecated Use `overlaps()` instead. */
327
+ ov = this . overlaps
328
+
329
+ /**
330
+ * Finds all rows whose text or tsvector value on the stated `column` matches
331
+ * the tsquery in `query`.
332
+ *
333
+ * @param column The column to filter on.
334
+ * @param query The Postgres tsquery string to filter with.
335
+ * @param config The text search configuration to use.
336
+ * @param type The type of tsquery conversion to use on `query`.
337
+ */
338
+ textSearch (
339
+ column : keyof T ,
340
+ query : string ,
341
+ {
342
+ config,
343
+ type = null ,
344
+ } : { config ?: string ; type ?: 'plain' | 'phrase' | 'websearch' | null } = { }
345
+ ) : this {
346
+ let typePart = ''
347
+ if ( type === 'plain' ) {
348
+ typePart = 'pl'
349
+ } else if ( type === 'phrase' ) {
350
+ typePart = 'ph'
351
+ } else if ( type === 'websearch' ) {
352
+ typePart = 'w'
353
+ }
354
+ const configPart = config === undefined ? '' : `(${ config } )`
355
+ this . url . searchParams . append ( `${ column } ` , `${ typePart } fts${ configPart } .${ query } ` )
356
+ return this
357
+ }
358
+
305
359
/**
306
360
* Finds all rows whose tsvector value on the stated `column` matches
307
361
* to_tsquery(`query`).
308
362
*
309
363
* @param column The column to filter on.
310
364
* @param query The Postgres tsquery string to filter with.
311
365
* @param config The text search configuration to use.
366
+ *
367
+ * @deprecated Use `textSearch()` instead.
312
368
*/
313
369
fts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
314
370
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -323,6 +379,8 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
323
379
* @param column The column to filter on.
324
380
* @param query The Postgres tsquery string to filter with.
325
381
* @param config The text search configuration to use.
382
+ *
383
+ * @deprecated Use `textSearch()` with `type: 'plain'` instead.
326
384
*/
327
385
plfts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
328
386
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -337,6 +395,8 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
337
395
* @param column The column to filter on.
338
396
* @param query The Postgres tsquery string to filter with.
339
397
* @param config The text search configuration to use.
398
+ *
399
+ * @deprecated Use `textSearch()` with `type: 'phrase'` instead.
340
400
*/
341
401
phfts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
342
402
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -351,6 +411,8 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
351
411
* @param column The column to filter on.
352
412
* @param query The Postgres tsquery string to filter with.
353
413
* @param config The text search configuration to use.
414
+ *
415
+ * @deprecated Use `textSearch()` with `type: 'websearch'` instead.
354
416
*/
355
417
wfts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
356
418
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
0 commit comments