@@ -182,7 +182,7 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
182
182
* @param column The column to filter on.
183
183
* @param value The value to filter with.
184
184
*/
185
- cs ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
185
+ contains ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
186
186
if ( typeof value === 'string' ) {
187
187
// range types can be inclusive '[', ']' or exclusive '(', ')' so just
188
188
// keep it simple and accept a string
@@ -197,14 +197,17 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
197
197
return this
198
198
}
199
199
200
+ /** @deprecated Use `contains()` instead. */
201
+ cs = this . contains
202
+
200
203
/**
201
204
* Finds all rows whose json, array, or range value on the stated `column` is
202
205
* contained by the specified `value`.
203
206
*
204
207
* @param column The column to filter on.
205
208
* @param value The value to filter with.
206
209
*/
207
- cd ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
210
+ containedBy ( column : keyof T , value : string | T [ keyof T ] [ ] | object ) : this {
208
211
if ( typeof value === 'string' ) {
209
212
// range
210
213
this . url . searchParams . append ( `${ column } ` , `cd.${ value } ` )
@@ -218,74 +221,92 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
218
221
return this
219
222
}
220
223
224
+ /** @deprecated Use `containedBy()` instead. */
225
+ cd = this . containedBy
226
+
221
227
/**
222
228
* Finds all rows whose range value on the stated `column` is strictly to the
223
229
* left of the specified `range`.
224
230
*
225
231
* @param column The column to filter on.
226
232
* @param range The range to filter with.
227
233
*/
228
- sl ( column : keyof T , range : string ) : this {
234
+ rangeLt ( column : keyof T , range : string ) : this {
229
235
this . url . searchParams . append ( `${ column } ` , `sl.${ range } ` )
230
236
return this
231
237
}
232
238
239
+ /** @deprecated Use `rangeLt()` instead. */
240
+ sl = this . rangeLt
241
+
233
242
/**
234
243
* Finds all rows whose range value on the stated `column` is strictly to
235
244
* the right of the specified `range`.
236
245
*
237
246
* @param column The column to filter on.
238
247
* @param range The range to filter with.
239
248
*/
240
- sr ( column : keyof T , range : string ) : this {
249
+ rangeGt ( column : keyof T , range : string ) : this {
241
250
this . url . searchParams . append ( `${ column } ` , `sr.${ range } ` )
242
251
return this
243
252
}
244
253
254
+ /** @deprecated Use `rangeGt()` instead. */
255
+ sr = this . rangeGt
256
+
245
257
/**
246
258
* Finds all rows whose range value on the stated `column` does not extend
247
259
* to the left of the specified `range`.
248
260
*
249
261
* @param column The column to filter on.
250
262
* @param range The range to filter with.
251
263
*/
252
- nxl ( column : keyof T , range : string ) : this {
264
+ rangeGte ( column : keyof T , range : string ) : this {
253
265
this . url . searchParams . append ( `${ column } ` , `nxl.${ range } ` )
254
266
return this
255
267
}
256
268
269
+ /** @deprecated Use `rangeGte()` instead. */
270
+ nxl = this . rangeGte
271
+
257
272
/**
258
273
* Finds all rows whose range value on the stated `column` does not extend
259
274
* to the right of the specified `range`.
260
275
*
261
276
* @param column The column to filter on.
262
277
* @param range The range to filter with.
263
278
*/
264
- nxr ( column : keyof T , range : string ) : this {
279
+ rangeLte ( column : keyof T , range : string ) : this {
265
280
this . url . searchParams . append ( `${ column } ` , `nxr.${ range } ` )
266
281
return this
267
282
}
268
283
284
+ /** @deprecated Use `rangeLte()` instead. */
285
+ nxr = this . rangeLte
286
+
269
287
/**
270
288
* Finds all rows whose range value on the stated `column` is adjacent to
271
289
* the specified `range`.
272
290
*
273
291
* @param column The column to filter on.
274
292
* @param range The range to filter with.
275
293
*/
276
- adj ( column : keyof T , range : string ) : this {
294
+ adjacent ( column : keyof T , range : string ) : this {
277
295
this . url . searchParams . append ( `${ column } ` , `adj.${ range } ` )
278
296
return this
279
297
}
280
298
299
+ /** @deprecated Use `adjacent()` instead. */
300
+ adj = this . adjacent
301
+
281
302
/**
282
- * Finds all rows whose array or range value on the stated `column` is
283
- * contained by the specified `value`.
303
+ * Finds all rows whose array or range value on the stated `column` overlaps
304
+ * (has a value in common) with the specified `value`.
284
305
*
285
306
* @param column The column to filter on.
286
307
* @param value The value to filter with.
287
308
*/
288
- ov ( column : keyof T , value : string | T [ keyof T ] [ ] ) : this {
309
+ overlaps ( column : keyof T , value : string | T [ keyof T ] [ ] ) : this {
289
310
if ( typeof value === 'string' ) {
290
311
// range
291
312
this . url . searchParams . append ( `${ column } ` , `ov.${ value } ` )
@@ -296,13 +317,48 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
296
317
return this
297
318
}
298
319
320
+ /** @deprecated Use `overlaps()` instead. */
321
+ ov = this . overlaps
322
+
323
+ /**
324
+ * Finds all rows whose text or tsvector value on the stated `column` matches
325
+ * the tsquery in `query`.
326
+ *
327
+ * @param column The column to filter on.
328
+ * @param query The Postgres tsquery string to filter with.
329
+ * @param config The text search configuration to use.
330
+ * @param type The type of tsquery conversion to use on `query`.
331
+ */
332
+ textSearch (
333
+ column : keyof T ,
334
+ query : string ,
335
+ {
336
+ config,
337
+ type = null ,
338
+ } : { config ?: string ; type ?: 'plain' | 'phrase' | 'websearch' | null } = { }
339
+ ) : this {
340
+ let typePart = ''
341
+ if ( type === 'plain' ) {
342
+ typePart = 'pl'
343
+ } else if ( type === 'phrase' ) {
344
+ typePart = 'ph'
345
+ } else if ( type === 'websearch' ) {
346
+ typePart = 'w'
347
+ }
348
+ const configPart = config === undefined ? '' : `(${ config } )`
349
+ this . url . searchParams . append ( `${ column } ` , `${ typePart } fts${ configPart } .${ query } ` )
350
+ return this
351
+ }
352
+
299
353
/**
300
354
* Finds all rows whose tsvector value on the stated `column` matches
301
355
* to_tsquery(`query`).
302
356
*
303
357
* @param column The column to filter on.
304
358
* @param query The Postgres tsquery string to filter with.
305
359
* @param config The text search configuration to use.
360
+ *
361
+ * @deprecated Use `textSearch()` instead.
306
362
*/
307
363
fts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
308
364
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -317,6 +373,8 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
317
373
* @param column The column to filter on.
318
374
* @param query The Postgres tsquery string to filter with.
319
375
* @param config The text search configuration to use.
376
+ *
377
+ * @deprecated Use `textSearch()` with `type: 'plain'` instead.
320
378
*/
321
379
plfts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
322
380
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -331,6 +389,8 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
331
389
* @param column The column to filter on.
332
390
* @param query The Postgres tsquery string to filter with.
333
391
* @param config The text search configuration to use.
392
+ *
393
+ * @deprecated Use `textSearch()` with `type: 'phrase'` instead.
334
394
*/
335
395
phfts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
336
396
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
@@ -345,6 +405,8 @@ export default class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder
345
405
* @param column The column to filter on.
346
406
* @param query The Postgres tsquery string to filter with.
347
407
* @param config The text search configuration to use.
408
+ *
409
+ * @deprecated Use `textSearch()` with `type: 'websearch'` instead.
348
410
*/
349
411
wfts ( column : keyof T , query : string , { config } : { config ?: string } = { } ) : this {
350
412
const configPart = typeof config === 'undefined' ? '' : `(${ config } )`
0 commit comments