Skip to content

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

@reactor/data — postgrestquerybuilder

@reactor/data


@reactor/data / PostgrestQueryBuilder

Defined in: builder.ts:346

Builder for SELECT queries with column selection.

T

new PostgrestQueryBuilder<T>(ctx, table): PostgrestQueryBuilder<T>

Defined in: builder.ts:39

RequestContext

string

PostgrestQueryBuilder<T>

PostgrestFilterBuilder.constructor

protected optional body?: unknown

Defined in: builder.ts:37

PostgrestFilterBuilder.body


protected optional countMode?: CountMode

Defined in: builder.ts:30

PostgrestFilterBuilder.countMode


protected ctx: RequestContext

Defined in: builder.ts:24

PostgrestFilterBuilder.ctx


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

Defined in: builder.ts:32

PostgrestFilterBuilder.customHeaders


protected optional explainMode?: object

Defined in: builder.ts:34

optional analyze?: boolean

optional buffers?: boolean

optional costs?: boolean

optional verbose?: boolean

PostgrestFilterBuilder.explainMode


protected filters: PendingFilter[] = []

Defined in: builder.ts:26

PostgrestFilterBuilder.filters


protected optional limitValue?: number

Defined in: builder.ts:28

PostgrestFilterBuilder.limitValue


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

Defined in: builder.ts:36

PostgrestFilterBuilder.method


protected optional offsetValue?: number

Defined in: builder.ts:29

PostgrestFilterBuilder.offsetValue


protected orderClauses: string[] = []

Defined in: builder.ts:27

PostgrestFilterBuilder.orderClauses


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

Defined in: builder.ts:33

PostgrestFilterBuilder.responseFormat


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

Defined in: builder.ts:35

PostgrestFilterBuilder.resultModifier


protected selectColumns: string = '*'

Defined in: builder.ts:25

PostgrestFilterBuilder.selectColumns


protected optional signalValue?: AbortSignal

Defined in: builder.ts:31

PostgrestFilterBuilder.signalValue


protected table: string

Defined in: builder.ts:23

PostgrestFilterBuilder.table

abortSignal(signal): this

Defined in: builder.ts:199

Provide an AbortSignal

AbortSignal

this

PostgrestFilterBuilder.abortSignal


protected buildHeaders(): Record<string, string>

Defined in: builder.ts:264

Record<string, string>

PostgrestFilterBuilder.buildHeaders


protected buildUrl(): string

Defined in: builder.ts:233

string

PostgrestFilterBuilder.buildUrl


containedBy<K>(column, values): this

Defined in: builder.ts:111

Array contained by

K extends string

K

unknown[]

this

PostgrestFilterBuilder.containedBy


contains<K>(column, values): this

Defined in: builder.ts:105

Array contains

K extends string

K

unknown[]

this

PostgrestFilterBuilder.contains


csv(): PostgrestFilterBuilder<T, string>

Defined in: builder.ts:205

Return CSV instead of JSON

PostgrestFilterBuilder<T, string>

PostgrestFilterBuilder.csv


delete(options?): PostgrestFilterBuilder<T>

Defined in: builder.ts:387

Delete row(s)

CountMode

PostgrestFilterBuilder<T>


eq<K>(column, value): this

Defined in: builder.ts:45

Equal to

K extends string

K

T[K]

this

PostgrestFilterBuilder.eq


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

Defined in: builder.ts:312

Promise<Result<unknown>>

PostgrestFilterBuilder.execute


explain(options?): this

Defined in: builder.ts:211

Return query execution plan

boolean

boolean

boolean

boolean

this

PostgrestFilterBuilder.explain


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

Defined in: builder.ts:154

Generic filter (escape hatch)

K extends string

K

FilterOperator

FilterValue

this

PostgrestFilterBuilder.filter


gt<K>(column, value): this

Defined in: builder.ts:57

Greater than

K extends string

K

T[K]

this

PostgrestFilterBuilder.gt


gte<K>(column, value): this

Defined in: builder.ts:63

Greater than or equal

K extends string

K

T[K]

this

PostgrestFilterBuilder.gte


ilike<K>(column, pattern): this

Defined in: builder.ts:87

Case-insensitive pattern match (ILIKE)

K extends string

K

string

this

PostgrestFilterBuilder.ilike


in<K>(column, values): this

Defined in: builder.ts:99

In list

K extends string

K

T[K][]

this

PostgrestFilterBuilder.in


insert(values, options?): PostgrestFilterBuilder<T>

Defined in: builder.ts:359

Insert row(s)

Partial<T> | Partial<T>[]

CountMode

PostgrestFilterBuilder<T>


is<K>(column, value): this

Defined in: builder.ts:93

Is NULL or boolean

K extends string

K

boolean | null

this

PostgrestFilterBuilder.is


like<K>(column, pattern): this

Defined in: builder.ts:81

Pattern match (LIKE)

K extends string

K

string

this

PostgrestFilterBuilder.like


limit(count, options?): this

Defined in: builder.ts:177

Limit results

number

string

this

PostgrestFilterBuilder.limit


lt<K>(column, value): this

Defined in: builder.ts:69

Less than

K extends string

K

T[K]

this

PostgrestFilterBuilder.lt


lte<K>(column, value): this

Defined in: builder.ts:75

Less than or equal

K extends string

K

T[K]

this

PostgrestFilterBuilder.lte


match(query): this

Defined in: builder.ts:131

Match multiple conditions (shorthand for multiple eq)

Partial<T>

this

PostgrestFilterBuilder.match


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

Defined in: builder.ts:228

Execute and return zero or one row

PostgrestFilterBuilder<T, T | null>

PostgrestFilterBuilder.maybeSingle


neq<K>(column, value): this

Defined in: builder.ts:51

Not equal to

K extends string

K

T[K]

this

PostgrestFilterBuilder.neq


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

Defined in: builder.ts:141

Negate a filter

K extends string

K

FilterOperator

FilterValue

this

PostgrestFilterBuilder.not


or(conditions, options?): this

Defined in: builder.ts:147

OR condition (raw string format)

string

string

this

PostgrestFilterBuilder.or


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

Defined in: builder.ts:160

Order results

K extends string

K

OrderOptions

this

PostgrestFilterBuilder.order


overlaps<K>(column, values): this

Defined in: builder.ts:117

Array overlaps

K extends string

K

unknown[]

this

PostgrestFilterBuilder.overlaps


range(from, to, options?): this

Defined in: builder.ts:187

Offset results (for pagination)

number

number

string

this

PostgrestFilterBuilder.range


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

Defined in: builder.ts:217

Override return type

R

PostgrestFilterBuilder<R, R[]>

PostgrestFilterBuilder.returns


select<Columns>(columns?, options?): PostgrestFilterBuilder<T>

Defined in: builder.ts:348

Select specific columns

Columns extends string = "*"

Columns

CountMode

PostgrestFilterBuilder<T>


single(): PostgrestFilterBuilder<T, T>

Defined in: builder.ts:222

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

PostgrestFilterBuilder<T, T>

PostgrestFilterBuilder.single


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

Defined in: builder.ts:123

Full-text search

K extends string

K

string

TextSearchOptions

this

PostgrestFilterBuilder.textSearch


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>

PostgrestFilterBuilder.then


throwOnError(): Promise<T[]>

Defined in: builder.ts:328

Throw on error instead of returning { data, error }

Promise<T[]>

PostgrestFilterBuilder.throwOnError


update(values, options?): PostgrestFilterBuilder<T>

Defined in: builder.ts:379

Update row(s)

Partial<T>

CountMode

PostgrestFilterBuilder<T>


upsert(values, options?): PostgrestFilterBuilder<T>

Defined in: builder.ts:367

Upsert row(s)

Partial<T> | Partial<T>[]

UpsertOptions

PostgrestFilterBuilder<T>