@reactor/data — postgrestfilterbuilder
@reactor/data / PostgrestFilterBuilder
Class: PostgrestFilterBuilder<T, ResultType>
Section titled “Class: PostgrestFilterBuilder<T, ResultType>”Defined in: builder.ts:22
PostgrestFilterBuilder provides methods for building filter queries.
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”T
ResultType
Section titled “ResultType”ResultType = T[]
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PostgrestFilterBuilder<
T,ResultType>(ctx,table):PostgrestFilterBuilder<T,ResultType>
Defined in: builder.ts:39
Parameters
Section titled “Parameters”RequestContext
string
Returns
Section titled “Returns”PostgrestFilterBuilder<T, ResultType>
Properties
Section titled “Properties”
protectedoptionalbody?:unknown
Defined in: builder.ts:37
countMode?
Section titled “countMode?”
protectedoptionalcountMode?:CountMode
Defined in: builder.ts:30
protectedctx:RequestContext
Defined in: builder.ts:24
customHeaders
Section titled “customHeaders”
protectedcustomHeaders:Record<string,string> ={}
Defined in: builder.ts:32
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
filters
Section titled “filters”
protectedfilters:PendingFilter[] =[]
Defined in: builder.ts:26
limitValue?
Section titled “limitValue?”
protectedoptionallimitValue?:number
Defined in: builder.ts:28
method
Section titled “method”
protectedmethod:"GET"|"POST"|"PATCH"|"DELETE"='GET'
Defined in: builder.ts:36
offsetValue?
Section titled “offsetValue?”
protectedoptionaloffsetValue?:number
Defined in: builder.ts:29
orderClauses
Section titled “orderClauses”
protectedorderClauses:string[] =[]
Defined in: builder.ts:27
responseFormat
Section titled “responseFormat”
protectedresponseFormat:"json"|"csv"='json'
Defined in: builder.ts:33
resultModifier?
Section titled “resultModifier?”
protectedoptionalresultModifier?:"single"|"maybeSingle"
Defined in: builder.ts:35
selectColumns
Section titled “selectColumns”
protectedselectColumns:string='*'
Defined in: builder.ts:25
signalValue?
Section titled “signalValue?”
protectedoptionalsignalValue?:AbortSignal
Defined in: builder.ts:31
protectedtable:string
Defined in: builder.ts:23
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
buildHeaders()
Section titled “buildHeaders()”
protectedbuildHeaders():Record<string,string>
Defined in: builder.ts:264
Returns
Section titled “Returns”Record<string, string>
buildUrl()
Section titled “buildUrl()”
protectedbuildUrl():string
Defined in: builder.ts:233
Returns
Section titled “Returns”string
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
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
csv():
PostgrestFilterBuilder<T,string>
Defined in: builder.ts:205
Return CSV instead of JSON
Returns
Section titled “Returns”PostgrestFilterBuilder<T, string>
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
execute()
Section titled “execute()”
protectedexecute():Promise<Result<unknown>>
Defined in: builder.ts:312
Returns
Section titled “Returns”Promise<Result<unknown>>
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
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
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
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
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
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
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
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
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
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
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
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
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>
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
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
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
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
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
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
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[]>
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>
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
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>
throwOnError()
Section titled “throwOnError()”throwOnError():
Promise<ResultType>
Defined in: builder.ts:328
Throw on error instead of returning { data, error }
Returns
Section titled “Returns”Promise<ResultType>