Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 2b8aa76

Browse files
authored
Removed changes except the link ones
1 parent 43ace64 commit 2b8aa76

File tree

1 file changed

+71
-73
lines changed

1 file changed

+71
-73
lines changed

src/builder.ts

Lines changed: 71 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface PostgrestResponse<T> {
2929
/**
3030
* Base builder
3131
*/
32+
3233
export abstract class PostgrestBuilder<T> implements PromiseLike<any> {
3334
method!: 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE'
3435
url!: URL
@@ -97,7 +98,7 @@ export class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> {
9798
/**
9899
* Performs horizontal filtering with SELECT.
99100
*
100-
* @param {string} columns - The columns to retrieve, separated by commas.
101+
* @param columns The columns to retrieve, separated by commas.
101102
*/
102103
select(columns = '*'): PostgrestFilterBuilder<T> {
103104
this.method = 'GET'
@@ -122,8 +123,8 @@ export class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> {
122123
/**
123124
* Performs an INSERT into the table.
124125
*
125-
* @param {(Partial<T>|Partial<T>[])} values - The values to insert.
126-
* @param {boolean} object.upsert - If `true`, performs an UPSERT.
126+
* @param values The values to insert.
127+
* @param upsert If `true`, performs an UPSERT.
127128
*/
128129
insert(values: Partial<T> | Partial<T>[], { upsert = false } = {}): PostgrestBuilder<T> {
129130
this.method = 'POST'
@@ -137,7 +138,7 @@ export class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> {
137138
/**
138139
* Performs an UPDATE on the table.
139140
*
140-
* @param {Partial<T>} values - The values to update.
141+
* @param values The values to update.
141142
*/
142143
update(values: Partial<T>): PostgrestFilterBuilder<T> {
143144
this.method = 'PATCH'
@@ -155,10 +156,7 @@ export class PostgrestQueryBuilder<T> extends PostgrestBuilder<T> {
155156
return new PostgrestFilterBuilder(this)
156157
}
157158

158-
/**
159-
* @internal
160-
* @param {?object} params
161-
*/
159+
/** @internal */
162160
rpc(params?: object): PostgrestBuilder<T> {
163161
this.method = 'POST'
164162
this.body = params
@@ -174,10 +172,10 @@ class PostgrestTransformBuilder<T> extends PostgrestBuilder<T> {
174172
/**
175173
* Orders the result with the specified `column`.
176174
*
177-
* @param {T} column - The column to order on.
178-
* @param {?boolean} ascending - If `true`, the result will be in ascending order.
179-
* @param {?boolean} nullsFirst - If `true`, `null`s appear first.
180-
* @param {?string} foreignTable - The foreign table to use (if `column` is a foreign column).
175+
* @param column The column to order on.
176+
* @param ascending If `true`, the result will be in ascending order.
177+
* @param nullsFirst If `true`, `null`s appear first.
178+
* @param foreignTable The foreign table to use (if `column` is a foreign column).
181179
*/
182180
order(
183181
column: keyof T,
@@ -198,8 +196,8 @@ class PostgrestTransformBuilder<T> extends PostgrestBuilder<T> {
198196
/**
199197
* Limits the result with the specified `count`.
200198
*
201-
* @param {number} count - The maximum no. of rows to limit to.
202-
* @param {?string} object.foreignTable - The foreign table to use (for foreign columns).
199+
* @param count The maximum no. of rows to limit to.
200+
* @param foreignTable The foreign table to use (for foreign columns).
203201
*/
204202
limit(
205203
count: number,
@@ -213,9 +211,9 @@ class PostgrestTransformBuilder<T> extends PostgrestBuilder<T> {
213211
/**
214212
* Limits the result to rows within the specified range, inclusive.
215213
*
216-
* @param {number} from - The starting index from which to limit the result, inclusive.
217-
* @param {number} to - The last index to which to limit the result, inclusive.
218-
* @param {?string} foreignTable - The foreign table to use (for foreign columns).
214+
* @param from The starting index from which to limit the result, inclusive.
215+
* @param to The last index to which to limit the result, inclusive.
216+
* @param foreignTable The foreign table to use (for foreign columns).
219217
*/
220218
range(
221219
from: number,
@@ -274,9 +272,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
274272
/**
275273
* Finds all rows which doesn't satisfy the filter.
276274
*
277-
* @param {T} column - The column to filter on.
278-
* @param {FilterOperator} operator - The operator to filter with.
279-
* @param {*} value - The value to filter with.
275+
* @param column The column to filter on.
276+
* @param operator The operator to filter with.
277+
* @param value The value to filter with.
280278
*/
281279
not(column: keyof T, operator: FilterOperator, value: any): this {
282280
this.url.searchParams.append(`${column}`, `not.${operator}.${value}`)
@@ -286,7 +284,7 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
286284
/**
287285
* Finds all rows satisfying at least one of the filters.
288286
*
289-
* @param {string} filters - The filters to use, separated by commas.
287+
* @param filters The filters to use, separated by commas.
290288
*/
291289
or(filters: string): this {
292290
this.url.searchParams.append('or', `(${filters})`)
@@ -297,8 +295,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
297295
* Finds all rows whose value on the stated `column` exactly matches the
298296
* specified `value`.
299297
*
300-
* @param {T} column - The column to filter on.
301-
* @param {T[]} value - The value to filter with.
298+
* @param column The column to filter on.
299+
* @param value The value to filter with.
302300
*/
303301
eq(column: keyof T, value: T[keyof T]): this {
304302
this.url.searchParams.append(`${column}`, `eq.${value}`)
@@ -309,8 +307,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
309307
* Finds all rows whose value on the stated `column` doesn't match the
310308
* specified `value`.
311309
*
312-
* @param {T} column - The column to filter on.
313-
* @param {T[]} value - The value to filter with.
310+
* @param column The column to filter on.
311+
* @param value The value to filter with.
314312
*/
315313
neq(column: keyof T, value: T[keyof T]): this {
316314
this.url.searchParams.append(`${column}`, `neq.${value}`)
@@ -321,8 +319,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
321319
* Finds all rows whose value on the stated `column` is greater than the
322320
* specified `value`.
323321
*
324-
* @param {T} column - The column to filter on.
325-
* @param {T[]} value - The value to filter with.
322+
* @param column The column to filter on.
323+
* @param value The value to filter with.
326324
*/
327325
gt(column: keyof T, value: T[keyof T]): this {
328326
this.url.searchParams.append(`${column}`, `gt.${value}`)
@@ -333,8 +331,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
333331
* Finds all rows whose value on the stated `column` is greater than or
334332
* equal to the specified `value`.
335333
*
336-
* @param {T} column - The column to filter on.
337-
* @param {T[]} value - The value to filter with.
334+
* @param column The column to filter on.
335+
* @param value The value to filter with.
338336
*/
339337
gte(column: keyof T, value: T[keyof T]): this {
340338
this.url.searchParams.append(`${column}`, `gte.${value}`)
@@ -345,8 +343,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
345343
* Finds all rows whose value on the stated `column` is less than the
346344
* specified `value`.
347345
*
348-
* @param {T} column - The column to filter on.
349-
* @param {T[]} value - The value to filter with.
346+
* @param column The column to filter on.
347+
* @param value The value to filter with.
350348
*/
351349
lt(column: keyof T, value: T[keyof T]): this {
352350
this.url.searchParams.append(`${column}`, `lt.${value}`)
@@ -357,8 +355,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
357355
* Finds all rows whose value on the stated `column` is less than or equal
358356
* to the specified `value`.
359357
*
360-
* @param {T} column - The column to filter on.
361-
* @param {T[]} value - The value to filter with.
358+
* @param column The column to filter on.
359+
* @param value The value to filter with.
362360
*/
363361
lte(column: keyof T, value: T[keyof T]): this {
364362
this.url.searchParams.append(`${column}`, `lte.${value}`)
@@ -369,8 +367,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
369367
* Finds all rows whose value in the stated `column` matches the supplied
370368
* `pattern` (case sensitive).
371369
*
372-
* @param {T} column - The column to filter on.
373-
* @param {string} pattern - The pattern to filter with.
370+
* @param column The column to filter on.
371+
* @param pattern The pattern to filter with.
374372
*/
375373
like(column: keyof T, pattern: string): this {
376374
this.url.searchParams.append(`${column}`, `like.${pattern}`)
@@ -381,8 +379,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
381379
* Finds all rows whose value in the stated `column` matches the supplied
382380
* `pattern` (case insensitive).
383381
*
384-
* @param {T} column - The column to filter on.
385-
* @param {string} pattern - The pattern to filter with.
382+
* @param column The column to filter on.
383+
* @param pattern The pattern to filter with.
386384
*/
387385
ilike(column: keyof T, pattern: string): this {
388386
this.url.searchParams.append(`${column}`, `ilike.${pattern}`)
@@ -393,8 +391,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
393391
* A check for exact equality (null, true, false), finds all rows whose
394392
* value on the stated `column` exactly match the specified `value`.
395393
*
396-
* @param {T} column - The column to filter on.
397-
* @param {(boolean|null)} value - The value to filter with.
394+
* @param column The column to filter on.
395+
* @param value The value to filter with.
398396
*/
399397
is(column: keyof T, value: boolean | null): this {
400398
this.url.searchParams.append(`${column}`, `is.${value}`)
@@ -405,8 +403,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
405403
* Finds all rows whose value on the stated `column` is found on the
406404
* specified `values`.
407405
*
408-
* @param {T} column - The column to filter on.
409-
* @param {T[]} values - The values to filter with.
406+
* @param column The column to filter on.
407+
* @param values The values to filter with.
410408
*/
411409
in(column: keyof T, values: T[keyof T][]): this {
412410
this.url.searchParams.append(`${column}`, `in.(${cleanFilterArray(values)})`)
@@ -417,8 +415,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
417415
* Finds all rows whose json, array, or range value on the stated `column`
418416
* contains the values specified in `value`.
419417
*
420-
* @param {T} column - The column to filter on.
421-
* @param {(string|T[][]|object)} value - The value to filter with.
418+
* @param column The column to filter on.
419+
* @param value The value to filter with.
422420
*/
423421
cs(column: keyof T, value: string | T[keyof T][] | object): this {
424422
if (typeof value === 'string') {
@@ -439,8 +437,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
439437
* Finds all rows whose json, array, or range value on the stated `column` is
440438
* contained by the specified `value`.
441439
*
442-
* @param {T} column - The column to filter on.
443-
* @param {string|T[][]|object} value - The value to filter with.
440+
* @param column The column to filter on.
441+
* @param value The value to filter with.
444442
*/
445443
cd(column: keyof T, value: string | T[keyof T][] | object): this {
446444
if (typeof value === 'string') {
@@ -460,8 +458,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
460458
* Finds all rows whose range value on the stated `column` is strictly to the
461459
* left of the specified `range`.
462460
*
463-
* @param {T} column - The column to filter on.
464-
* @param {string} range - The range to filter with.
461+
* @param column The column to filter on.
462+
* @param range The range to filter with.
465463
*/
466464
sl(column: keyof T, range: string): this {
467465
this.url.searchParams.append(`${column}`, `sl.${range}`)
@@ -472,8 +470,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
472470
* Finds all rows whose range value on the stated `column` is strictly to
473471
* the right of the specified `range`.
474472
*
475-
* @param {T} column - The column to filter on.
476-
* @param {string} range - The range to filter with.
473+
* @param column The column to filter on.
474+
* @param range The range to filter with.
477475
*/
478476
sr(column: keyof T, range: string): this {
479477
this.url.searchParams.append(`${column}`, `sr.${range}`)
@@ -484,8 +482,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
484482
* Finds all rows whose range value on the stated `column` does not extend
485483
* to the left of the specified `range`.
486484
*
487-
* @param {T} column - The column to filter on.
488-
* @param {string} range - The range to filter with.
485+
* @param column The column to filter on.
486+
* @param range The range to filter with.
489487
*/
490488
nxl(column: keyof T, range: string): this {
491489
this.url.searchParams.append(`${column}`, `nxl.${range}`)
@@ -496,8 +494,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
496494
* Finds all rows whose range value on the stated `column` does not extend
497495
* to the right of the specified `range`.
498496
*
499-
* @param {T} column - The column to filter on.
500-
* @param {string} range - The range to filter with.
497+
* @param column The column to filter on.
498+
* @param range The range to filter with.
501499
*/
502500
nxr(column: keyof T, range: string): this {
503501
this.url.searchParams.append(`${column}`, `nxr.${range}`)
@@ -508,8 +506,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
508506
* Finds all rows whose range value on the stated `column` is adjacent to
509507
* the specified `range`.
510508
*
511-
* @param {T} column - The column to filter on.
512-
* @param {string} range - The range to filter with.
509+
* @param column The column to filter on.
510+
* @param range The range to filter with.
513511
*/
514512
adj(column: keyof T, range: string): this {
515513
this.url.searchParams.append(`${column}`, `adj.${range}`)
@@ -520,8 +518,8 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
520518
* Finds all rows whose array or range value on the stated `column` is
521519
* contained by the specified `value`.
522520
*
523-
* @param {T} column - The column to filter on.
524-
* @param {(string|T[][])} value - The value to filter with.
521+
* @param column The column to filter on.
522+
* @param value The value to filter with.
525523
*/
526524
ov(column: keyof T, value: string | T[keyof T][]): this {
527525
if (typeof value === 'string') {
@@ -538,9 +536,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
538536
* Finds all rows whose tsvector value on the stated `column` matches
539537
* to_tsquery(`query`).
540538
*
541-
* @param {T} column - The column to filter on.
542-
* @param {string} query - The Postgres tsquery string to filter with.
543-
* @param {?string} config - The text search configuration to use.
539+
* @param column The column to filter on.
540+
* @param query The Postgres tsquery string to filter with.
541+
* @param config The text search configuration to use.
544542
*/
545543
fts(column: keyof T, query: string, { config }: { config?: string } = {}): this {
546544
const configPart = typeof config === 'undefined' ? '' : `(${config})`
@@ -552,9 +550,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
552550
* Finds all rows whose tsvector value on the stated `column` matches
553551
* plainto_tsquery(`query`).
554552
*
555-
* @param {*} column - The column to filter on.
556-
* @param {string} query - The Postgres tsquery string to filter with.
557-
* @param {?string} config - The text search configuration to use.
553+
* @param column The column to filter on.
554+
* @param query The Postgres tsquery string to filter with.
555+
* @param config The text search configuration to use.
558556
*/
559557
plfts(column: keyof T, query: string, { config }: { config?: string } = {}): this {
560558
const configPart = typeof config === 'undefined' ? '' : `(${config})`
@@ -566,9 +564,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
566564
* Finds all rows whose tsvector value on the stated `column` matches
567565
* phraseto_tsquery(`query`).
568566
*
569-
* @param {T} column - The column to filter on.
570-
* @param {string} query - The Postgres tsquery string to filter with.
571-
* @param {?string} config - The text search configuration to use.
567+
* @param column The column to filter on.
568+
* @param query The Postgres tsquery string to filter with.
569+
* @param config The text search configuration to use.
572570
*/
573571
phfts(column: keyof T, query: string, { config }: { config?: string } = {}): this {
574572
const configPart = typeof config === 'undefined' ? '' : `(${config})`
@@ -580,9 +578,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
580578
* Finds all rows whose tsvector value on the stated `column` matches
581579
* websearch_to_tsquery(`query`).
582580
*
583-
* @param {T} column - The column to filter on.
584-
* @param {string}query - The Postgres tsquery string to filter with.
585-
* @param {?string} config - The text search configuration to use.
581+
* @param column The column to filter on.
582+
* @param query The Postgres tsquery string to filter with.
583+
* @param config The text search configuration to use.
586584
*/
587585
wfts(column: keyof T, query: string, { config }: { config?: string } = {}): this {
588586
const configPart = typeof config === 'undefined' ? '' : `(${config})`
@@ -593,9 +591,9 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
593591
/**
594592
* Finds all rows whose `column` satisfies the filter.
595593
*
596-
* @param {T} column - The column to filter on.
597-
* @param {FilterOperator} operator - The operator to filter with.
598-
* @param {*} value - The value to filter with.
594+
* @param column The column to filter on.
595+
* @param operator The operator to filter with.
596+
* @param value The value to filter with.
599597
*/
600598
filter(column: keyof T, operator: FilterOperator, value: any): this {
601599
this.url.searchParams.append(`${column}`, `${operator}.${value}`)
@@ -605,7 +603,7 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
605603
/**
606604
* Finds all rows whose columns match the specified `query` object.
607605
*
608-
* @param {object} query - The object to filter with, with column names as keys mapped
606+
* @param query The object to filter with, with column names as keys mapped
609607
* to their filter values.
610608
*/
611609
match(query: { [key: string]: string }) {

0 commit comments

Comments
 (0)