@reactor/data — postgrestquerybuilder
@reactor/data / PostgrestQueryBuilder
Class: PostgrestQueryBuilder<T>
Section titled “Class: PostgrestQueryBuilder<T>”Defined in: builder.ts:346
Builder for SELECT queries with column selection.
Extends
Section titled “Extends”Type Parameters
Section titled “Type Parameters”T
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PostgrestQueryBuilder<
T>(ctx,table):PostgrestQueryBuilder<T>
Defined in: builder.ts:39
Parameters
Section titled “Parameters”RequestContext
string
Returns
Section titled “Returns”PostgrestQueryBuilder<T>
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.constructor
Properties
Section titled “Properties”
protectedoptionalbody?:unknown
Defined in: builder.ts:37
Inherited from
Section titled “Inherited from”countMode?
Section titled “countMode?”
protectedoptionalcountMode?:CountMode
Defined in: builder.ts:30
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.countMode
protectedctx:RequestContext
Defined in: builder.ts:24
Inherited from
Section titled “Inherited from”customHeaders
Section titled “customHeaders”
protectedcustomHeaders:Record<string,string> ={}
Defined in: builder.ts:32
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.customHeaders
explainMode?
Section titled “explainMode?”
protectedoptionalexplainMode?:object
Defined in: builder.ts:34
analyze?
Section titled “analyze?”
optionalanalyze?:boolean
buffers?
Section titled “buffers?”
optionalbuffers?:boolean
costs?
Section titled “costs?”
optionalcosts?:boolean
verbose?
Section titled “verbose?”
optionalverbose?:boolean
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.explainMode
filters
Section titled “filters”
protectedfilters:PendingFilter[] =[]
Defined in: builder.ts:26
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.filters
limitValue?
Section titled “limitValue?”
protectedoptionallimitValue?:number
Defined in: builder.ts:28
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.limitValue
method
Section titled “method”
protectedmethod:"GET"|"POST"|"PATCH"|"DELETE"='GET'
Defined in: builder.ts:36
Inherited from
Section titled “Inherited from”offsetValue?
Section titled “offsetValue?”
protectedoptionaloffsetValue?:number
Defined in: builder.ts:29
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.offsetValue
orderClauses
Section titled “orderClauses”
protectedorderClauses:string[] =[]
Defined in: builder.ts:27
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.orderClauses
responseFormat
Section titled “responseFormat”
protectedresponseFormat:"json"|"csv"='json'
Defined in: builder.ts:33
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.responseFormat
resultModifier?
Section titled “resultModifier?”
protectedoptionalresultModifier?:"single"|"maybeSingle"
Defined in: builder.ts:35
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.resultModifier
selectColumns
Section titled “selectColumns”
protectedselectColumns:string='*'
Defined in: builder.ts:25
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.selectColumns
signalValue?
Section titled “signalValue?”
protectedoptionalsignalValue?:AbortSignal
Defined in: builder.ts:31
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.signalValue
protectedtable:string
Defined in: builder.ts:23
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”abortSignal()
Section titled “abortSignal()”abortSignal(
signal):this
Defined in: builder.ts:199
Provide an AbortSignal
Parameters
Section titled “Parameters”signal
Section titled “signal”AbortSignal
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.abortSignal
buildHeaders()
Section titled “buildHeaders()”
protectedbuildHeaders():Record<string,string>
Defined in: builder.ts:264
Returns
Section titled “Returns”Record<string, string>
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.buildHeaders
buildUrl()
Section titled “buildUrl()”
protectedbuildUrl():string
Defined in: builder.ts:233
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.buildUrl
containedBy()
Section titled “containedBy()”containedBy<
K>(column,values):this
Defined in: builder.ts:111
Array contained by
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
values
Section titled “values”unknown[]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.containedBy
contains()
Section titled “contains()”contains<
K>(column,values):this
Defined in: builder.ts:105
Array contains
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
values
Section titled “values”unknown[]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.contains
csv():
PostgrestFilterBuilder<T,string>
Defined in: builder.ts:205
Return CSV instead of JSON
Returns
Section titled “Returns”PostgrestFilterBuilder<T, string>
Inherited from
Section titled “Inherited from”delete()
Section titled “delete()”delete(
options?):PostgrestFilterBuilder<T>
Defined in: builder.ts:387
Delete row(s)
Parameters
Section titled “Parameters”options?
Section titled “options?”count?
Section titled “count?”Returns
Section titled “Returns”eq<
K>(column,value):this
Defined in: builder.ts:45
Equal to
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
T[K]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”execute()
Section titled “execute()”
protectedexecute():Promise<Result<unknown>>
Defined in: builder.ts:312
Returns
Section titled “Returns”Promise<Result<unknown>>
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.execute
explain()
Section titled “explain()”explain(
options?):this
Defined in: builder.ts:211
Return query execution plan
Parameters
Section titled “Parameters”options?
Section titled “options?”analyze?
Section titled “analyze?”boolean
buffers?
Section titled “buffers?”boolean
costs?
Section titled “costs?”boolean
verbose?
Section titled “verbose?”boolean
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.explain
filter()
Section titled “filter()”filter<
K>(column,operator,value):this
Defined in: builder.ts:154
Generic filter (escape hatch)
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
operator
Section titled “operator”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”gt<
K>(column,value):this
Defined in: builder.ts:57
Greater than
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
T[K]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”gte<
K>(column,value):this
Defined in: builder.ts:63
Greater than or equal
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
T[K]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ilike()
Section titled “ilike()”ilike<
K>(column,pattern):this
Defined in: builder.ts:87
Case-insensitive pattern match (ILIKE)
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
pattern
Section titled “pattern”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”in<
K>(column,values):this
Defined in: builder.ts:99
In list
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
values
Section titled “values”T[K][]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”insert()
Section titled “insert()”insert(
values,options?):PostgrestFilterBuilder<T>
Defined in: builder.ts:359
Insert row(s)
Parameters
Section titled “Parameters”values
Section titled “values”Partial<T> | Partial<T>[]
options?
Section titled “options?”count?
Section titled “count?”Returns
Section titled “Returns”is<
K>(column,value):this
Defined in: builder.ts:93
Is NULL or boolean
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
boolean | null
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”like()
Section titled “like()”like<
K>(column,pattern):this
Defined in: builder.ts:81
Pattern match (LIKE)
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
pattern
Section titled “pattern”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”limit()
Section titled “limit()”limit(
count,options?):this
Defined in: builder.ts:177
Limit results
Parameters
Section titled “Parameters”number
options?
Section titled “options?”foreignTable?
Section titled “foreignTable?”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”lt<
K>(column,value):this
Defined in: builder.ts:69
Less than
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
T[K]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”lte<
K>(column,value):this
Defined in: builder.ts:75
Less than or equal
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
T[K]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”match()
Section titled “match()”match(
query):this
Defined in: builder.ts:131
Match multiple conditions (shorthand for multiple eq)
Parameters
Section titled “Parameters”Partial<T>
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”maybeSingle()
Section titled “maybeSingle()”maybeSingle():
PostgrestFilterBuilder<T,T|null>
Defined in: builder.ts:228
Execute and return zero or one row
Returns
Section titled “Returns”PostgrestFilterBuilder<T, T | null>
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.maybeSingle
neq<
K>(column,value):this
Defined in: builder.ts:51
Not equal to
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
T[K]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”not<
K>(column,operator,value):this
Defined in: builder.ts:141
Negate a filter
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
operator
Section titled “operator”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”or(
conditions,options?):this
Defined in: builder.ts:147
OR condition (raw string format)
Parameters
Section titled “Parameters”conditions
Section titled “conditions”string
options?
Section titled “options?”foreignTable?
Section titled “foreignTable?”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”order()
Section titled “order()”order<
K>(column,options?):this
Defined in: builder.ts:160
Order results
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
options?
Section titled “options?”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”overlaps()
Section titled “overlaps()”overlaps<
K>(column,values):this
Defined in: builder.ts:117
Array overlaps
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
values
Section titled “values”unknown[]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.overlaps
range()
Section titled “range()”range(
from,to,options?):this
Defined in: builder.ts:187
Offset results (for pagination)
Parameters
Section titled “Parameters”number
number
options?
Section titled “options?”foreignTable?
Section titled “foreignTable?”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”returns()
Section titled “returns()”returns<
R>():PostgrestFilterBuilder<R,R[]>
Defined in: builder.ts:217
Override return type
Type Parameters
Section titled “Type Parameters”R
Returns
Section titled “Returns”PostgrestFilterBuilder<R, R[]>
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.returns
select()
Section titled “select()”select<
Columns>(columns?,options?):PostgrestFilterBuilder<T>
Defined in: builder.ts:348
Select specific columns
Type Parameters
Section titled “Type Parameters”Columns
Section titled “Columns”Columns extends string = "*"
Parameters
Section titled “Parameters”columns?
Section titled “columns?”Columns
options?
Section titled “options?”count?
Section titled “count?”Returns
Section titled “Returns”single()
Section titled “single()”single():
PostgrestFilterBuilder<T,T>
Defined in: builder.ts:222
Execute and return exactly one row (throws if not exactly one)
Returns
Section titled “Returns”PostgrestFilterBuilder<T, T>
Inherited from
Section titled “Inherited from”textSearch()
Section titled “textSearch()”textSearch<
K>(column,query,options?):this
Defined in: builder.ts:123
Full-text search
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”column
Section titled “column”K
string
options?
Section titled “options?”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.textSearch
then()
Section titled “then()”then<
TResult1,TResult2>(onfulfilled?,_onrejected?):Promise<TResult1|TResult2>
Defined in: builder.ts:292
Execute the query
Type Parameters
Section titled “Type Parameters”TResult1
Section titled “TResult1”TResult1 = Result<ResultType>
TResult2
Section titled “TResult2”TResult2 = never
Parameters
Section titled “Parameters”onfulfilled?
Section titled “onfulfilled?”((value) => TResult1 | PromiseLike<TResult1>) | null
_onrejected?
Section titled “_onrejected?”((reason) => TResult2 | PromiseLike<TResult2>) | null
Returns
Section titled “Returns”Promise<TResult1 | TResult2>
Inherited from
Section titled “Inherited from”throwOnError()
Section titled “throwOnError()”throwOnError():
Promise<T[]>
Defined in: builder.ts:328
Throw on error instead of returning { data, error }
Returns
Section titled “Returns”Promise<T[]>
Inherited from
Section titled “Inherited from”PostgrestFilterBuilder.throwOnError
update()
Section titled “update()”update(
values,options?):PostgrestFilterBuilder<T>
Defined in: builder.ts:379
Update row(s)
Parameters
Section titled “Parameters”values
Section titled “values”Partial<T>
options?
Section titled “options?”count?
Section titled “count?”Returns
Section titled “Returns”upsert()
Section titled “upsert()”upsert(
values,options?):PostgrestFilterBuilder<T>
Defined in: builder.ts:367
Upsert row(s)
Parameters
Section titled “Parameters”values
Section titled “values”Partial<T> | Partial<T>[]