Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

@reactor/data — postgrestfilterbuilder

@reactor/data


@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.

T

ResultType = T[]

new PostgrestFilterBuilder<T, ResultType>(ctx, table): PostgrestFilterBuilder<T, ResultType>

Defined in: builder.ts:39

RequestContext

string

PostgrestFilterBuilder<T, ResultType>

protected optional body?: unknown

Defined in: builder.ts:37


protected optional countMode?: CountMode

Defined in: builder.ts:30


protected ctx: RequestContext

Defined in: builder.ts:24


protected customHeaders: Record<string, string> = {}

Defined in: builder.ts:32


protected optional explainMode?: object

Defined in: builder.ts:34

optional analyze?: boolean

optional buffers?: boolean

optional costs?: boolean

optional verbose?: boolean


protected filters: PendingFilter[] = []

Defined in: builder.ts:26


protected optional limitValue?: number

Defined in: builder.ts:28


protected method: "GET" | "POST" | "PATCH" | "DELETE" = 'GET'

Defined in: builder.ts:36


protected optional offsetValue?: number

Defined in: builder.ts:29


protected orderClauses: string[] = []

Defined in: builder.ts:27


protected responseFormat: "json" | "csv" = 'json'

Defined in: builder.ts:33


protected optional resultModifier?: "single" | "maybeSingle"

Defined in: builder.ts:35


protected selectColumns: string = '*'

Defined in: builder.ts:25


protected optional signalValue?: AbortSignal

Defined in: builder.ts:31


protected table: string

Defined in: builder.ts:23

abortSignal(signal): this

Defined in: builder.ts:199

Provide an AbortSignal

AbortSignal

this


protected buildHeaders(): Record<string, string>

Defined in: builder.ts:264

Record<string, string>


protected buildUrl(): string

Defined in: builder.ts:233

string


containedBy<K>(column, values): this

Defined in: builder.ts:111

Array contained by

K extends string

K

unknown[]

this


contains<K>(column, values): this

Defined in: builder.ts:105

Array contains

K extends string

K

unknown[]

this


csv(): PostgrestFilterBuilder<T, string>

Defined in: builder.ts:205

Return CSV instead of JSON

PostgrestFilterBuilder<T, string>


eq<K>(column, value): this

Defined in: builder.ts:45

Equal to

K extends string

K

T[K]

this


protected execute(): Promise<Result<unknown>>

Defined in: builder.ts:312

Promise<Result<unknown>>


explain(options?): this

Defined in: builder.ts:211

Return query execution plan

boolean

boolean

boolean

boolean

this


filter<K>(column, operator, value): this

Defined in: builder.ts:154

Generic filter (escape hatch)

K extends string

K

FilterOperator

FilterValue

this


gt<K>(column, value): this

Defined in: builder.ts:57

Greater than

K extends string

K

T[K]

this


gte<K>(column, value): this

Defined in: builder.ts:63

Greater than or equal

K extends string

K

T[K]

this


ilike<K>(column, pattern): this

Defined in: builder.ts:87

Case-insensitive pattern match (ILIKE)

K extends string

K

string

this


in<K>(column, values): this

Defined in: builder.ts:99

In list

K extends string

K

T[K][]

this


is<K>(column, value): this

Defined in: builder.ts:93

Is NULL or boolean

K extends string

K

boolean | null

this


like<K>(column, pattern): this

Defined in: builder.ts:81

Pattern match (LIKE)

K extends string

K

string

this


limit(count, options?): this

Defined in: builder.ts:177

Limit results

number

string

this


lt<K>(column, value): this

Defined in: builder.ts:69

Less than

K extends string

K

T[K]

this


lte<K>(column, value): this

Defined in: builder.ts:75

Less than or equal

K extends string

K

T[K]

this


match(query): this

Defined in: builder.ts:131

Match multiple conditions (shorthand for multiple eq)

Partial<T>

this


maybeSingle(): PostgrestFilterBuilder<T, T | null>

Defined in: builder.ts:228

Execute and return zero or one row

PostgrestFilterBuilder<T, T | null>


neq<K>(column, value): this

Defined in: builder.ts:51

Not equal to

K extends string

K

T[K]

this


not<K>(column, operator, value): this

Defined in: builder.ts:141

Negate a filter

K extends string

K

FilterOperator

FilterValue

this


or(conditions, options?): this

Defined in: builder.ts:147

OR condition (raw string format)

string

string

this


order<K>(column, options?): this

Defined in: builder.ts:160

Order results

K extends string

K

OrderOptions

this


overlaps<K>(column, values): this

Defined in: builder.ts:117

Array overlaps

K extends string

K

unknown[]

this


range(from, to, options?): this

Defined in: builder.ts:187

Offset results (for pagination)

number

number

string

this


returns<R>(): PostgrestFilterBuilder<R, R[]>

Defined in: builder.ts:217

Override return type

R

PostgrestFilterBuilder<R, R[]>


single(): PostgrestFilterBuilder<T, T>

Defined in: builder.ts:222

Execute and return exactly one row (throws if not exactly one)

PostgrestFilterBuilder<T, T>


textSearch<K>(column, query, options?): this

Defined in: builder.ts:123

Full-text search

K extends string

K

string

TextSearchOptions

this


then<TResult1, TResult2>(onfulfilled?, _onrejected?): Promise<TResult1 | TResult2>

Defined in: builder.ts:292

Execute the query

TResult1 = Result<ResultType>

TResult2 = never

((value) => TResult1 | PromiseLike<TResult1>) | null

((reason) => TResult2 | PromiseLike<TResult2>) | null

Promise<TResult1 | TResult2>


throwOnError(): Promise<ResultType>

Defined in: builder.ts:328

Throw on error instead of returning { data, error }

Promise<ResultType>