Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

Type Parameters

  • Schema extends GenericSchema

  • Row extends Record<string, unknown>

  • Result

  • RelationName = unknown

  • Relationships = unknown

Hierarchy

Index

Constructors

Properties

body?: unknown
fetch: ((input: RequestInfo, init?: RequestInit) => Promise<Response>)

Type declaration

    • (input: RequestInfo, init?: RequestInit): Promise<Response>
    • Parameters

      • input: RequestInfo
      • Optional init: RequestInit

      Returns Promise<Response>

headers: Record<string, string>
isMaybeSingle: boolean
method: "GET" | "HEAD" | "POST" | "PATCH" | "DELETE"
schema?: string
shouldThrowOnError: boolean = false
signal?: AbortSignal
url: URL

Methods

  • containedBy<ColumnName>(column: ColumnName, value: string | Record<string, unknown> | readonly Row[ColumnName][]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • containedBy(column: string, value: string | Record<string, unknown> | readonly unknown[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Only relevant for jsonb, array, and range columns. Match only rows where every element appearing in column is contained by value.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The jsonb, array, or range column to filter on

    • value: string | Record<string, unknown> | readonly Row[ColumnName][]

      The jsonb, array, or range value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Only relevant for jsonb, array, and range columns. Match only rows where every element appearing in column is contained by value.

    Parameters

    • column: string

      The jsonb, array, or range column to filter on

    • value: string | Record<string, unknown> | readonly unknown[]

      The jsonb, array, or range value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • contains<ColumnName>(column: ColumnName, value: string | Record<string, unknown> | readonly Row[ColumnName][]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • contains(column: string, value: string | Record<string, unknown> | readonly unknown[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Only relevant for jsonb, array, and range columns. Match only rows where column contains every element appearing in value.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The jsonb, array, or range column to filter on

    • value: string | Record<string, unknown> | readonly Row[ColumnName][]

      The jsonb, array, or range value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Only relevant for jsonb, array, and range columns. Match only rows where column contains every element appearing in value.

    Parameters

    • column: string

      The jsonb, array, or range column to filter on

    • value: string | Record<string, unknown> | readonly unknown[]

      The jsonb, array, or range value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • eq<ColumnName>(column: ColumnName, value: NonNullable<Row[ColumnName]>): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • eq<Value>(column: string, value: NonNullable<Value>): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column is equal to value.

    To check if the value of column is NULL, you should use .is() instead.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • value: NonNullable<Row[ColumnName]>

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column is equal to value.

    To check if the value of column is NULL, you should use .is() instead.

    Type Parameters

    • Value extends unknown

    Parameters

    • column: string

      The column to filter on

    • value: NonNullable<Value>

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • explain(options?: { analyze?: boolean; buffers?: boolean; format?: "json" | "text"; settings?: boolean; verbose?: boolean; wal?: boolean }): PostgrestBuilder<string> | PostgrestBuilder<Record<string, unknown>[]>
  • Return data as the EXPLAIN plan for the query.

    You need to enable the db_plan_enabled setting before using this method.

    Parameters

    • options: { analyze?: boolean; buffers?: boolean; format?: "json" | "text"; settings?: boolean; verbose?: boolean; wal?: boolean } = {}

      Named parameters

      • Optional analyze?: boolean

        If true, the query will be executed and the actual run time will be returned

      • Optional buffers?: boolean

        If true, include information on buffer usage

      • Optional format?: "json" | "text"

        The format of the output, can be "text" (default) or "json"

      • Optional settings?: boolean

        If true, include information on configuration parameters that affect query planning

      • Optional verbose?: boolean

        If true, the query identifier will be returned and data will include the output columns of the query

      • Optional wal?: boolean

        If true, include information on WAL record generation

    Returns PostgrestBuilder<string> | PostgrestBuilder<Record<string, unknown>[]>

  • filter<ColumnName>(column: ColumnName, operator: FilterOperator | "not.eq" | "not.neq" | "not.gt" | "not.gte" | "not.lt" | "not.lte" | "not.like" | "not.ilike" | "not.is" | "not.in" | "not.cs" | "not.cd" | "not.sl" | "not.sr" | "not.nxl" | "not.nxr" | "not.adj" | "not.ov" | "not.fts" | "not.plfts" | "not.phfts" | "not.wfts", value: unknown): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • filter(column: string, operator: string, value: unknown): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows which satisfy the filter. This is an escape hatch - you should use the specific filter methods wherever possible.

    Unlike most filters, opearator and value are used as-is and need to follow PostgREST syntax. You also need to make sure they are properly sanitized.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • operator: FilterOperator | "not.eq" | "not.neq" | "not.gt" | "not.gte" | "not.lt" | "not.lte" | "not.like" | "not.ilike" | "not.is" | "not.in" | "not.cs" | "not.cd" | "not.sl" | "not.sr" | "not.nxl" | "not.nxr" | "not.adj" | "not.ov" | "not.fts" | "not.plfts" | "not.phfts" | "not.wfts"

      The operator to filter with, following PostgREST syntax

    • value: unknown

      The value to filter with, following PostgREST syntax

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows which satisfy the filter. This is an escape hatch - you should use the specific filter methods wherever possible.

    Unlike most filters, opearator and value are used as-is and need to follow PostgREST syntax. You also need to make sure they are properly sanitized.

    Parameters

    • column: string

      The column to filter on

    • operator: string

      The operator to filter with, following PostgREST syntax

    • value: unknown

      The value to filter with, following PostgREST syntax

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • gt<ColumnName>(column: ColumnName, value: Row[ColumnName]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • gt(column: string, value: unknown): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column is greater than value.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • value: Row[ColumnName]

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column is greater than value.

    Parameters

    • column: string

      The column to filter on

    • value: unknown

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • gte<ColumnName>(column: ColumnName, value: Row[ColumnName]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • gte(column: string, value: unknown): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column is greater than or equal to value.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • value: Row[ColumnName]

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column is greater than or equal to value.

    Parameters

    • column: string

      The column to filter on

    • value: unknown

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • ilike<ColumnName>(column: ColumnName, pattern: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • ilike(column: string, pattern: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column matches pattern case-insensitively.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • pattern: string

      The pattern to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column matches pattern case-insensitively.

    Parameters

    • column: string

      The column to filter on

    • pattern: string

      The pattern to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • ilikeAllOf<ColumnName>(column: ColumnName, patterns: readonly string[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • ilikeAllOf(column: string, patterns: readonly string[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column matches all of patterns case-insensitively.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • patterns: readonly string[]

      The patterns to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column matches all of patterns case-insensitively.

    Parameters

    • column: string

      The column to filter on

    • patterns: readonly string[]

      The patterns to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • ilikeAnyOf<ColumnName>(column: ColumnName, patterns: readonly string[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • ilikeAnyOf(column: string, patterns: readonly string[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column matches any of patterns case-insensitively.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • patterns: readonly string[]

      The patterns to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column matches any of patterns case-insensitively.

    Parameters

    • column: string

      The column to filter on

    • patterns: readonly string[]

      The patterns to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • in<ColumnName>(column: ColumnName, values: readonly Row[ColumnName][]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • in(column: string, values: readonly unknown[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column is included in the values array.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • values: readonly Row[ColumnName][]

      The values array to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column is included in the values array.

    Parameters

    • column: string

      The column to filter on

    • values: readonly unknown[]

      The values array to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • is<ColumnName>(column: ColumnName, value: Row[ColumnName] & null & Row[ColumnName] & false & Row[ColumnName] & true): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • is(column: string, value: null | boolean): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column IS value.

    For non-boolean columns, this is only relevant for checking if the value of column is NULL by setting value to null.

    For boolean columns, you can also set value to true or false and it will behave the same way as .eq().

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • value: Row[ColumnName] & null & Row[ColumnName] & false & Row[ColumnName] & true

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column IS value.

    For non-boolean columns, this is only relevant for checking if the value of column is NULL by setting value to null.

    For boolean columns, you can also set value to true or false and it will behave the same way as .eq().

    Parameters

    • column: string

      The column to filter on

    • value: null | boolean

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • like<ColumnName>(column: ColumnName, pattern: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • like(column: string, pattern: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column matches pattern case-sensitively.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • pattern: string

      The pattern to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column matches pattern case-sensitively.

    Parameters

    • column: string

      The column to filter on

    • pattern: string

      The pattern to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • likeAllOf<ColumnName>(column: ColumnName, patterns: readonly string[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • likeAllOf(column: string, patterns: readonly string[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column matches all of patterns case-sensitively.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • patterns: readonly string[]

      The patterns to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column matches all of patterns case-sensitively.

    Parameters

    • column: string

      The column to filter on

    • patterns: readonly string[]

      The patterns to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • likeAnyOf<ColumnName>(column: ColumnName, patterns: readonly string[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • likeAnyOf(column: string, patterns: readonly string[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column matches any of patterns case-sensitively.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • patterns: readonly string[]

      The patterns to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column matches any of patterns case-sensitively.

    Parameters

    • column: string

      The column to filter on

    • patterns: readonly string[]

      The patterns to match with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • limit(count: number, options?: { foreignTable?: string; referencedTable?: string }): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Limit the query result by count.

    Parameters

    • count: number

      The maximum number of rows to return

    • options: { foreignTable?: string; referencedTable?: string } = {}

      Named parameters

      • Optional foreignTable?: string

        Deprecated, use options.referencedTable instead

      • Optional referencedTable?: string

        Set this to limit rows of referenced tables instead of the parent table

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • lt<ColumnName>(column: ColumnName, value: Row[ColumnName]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • lt(column: string, value: unknown): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column is less than value.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • value: Row[ColumnName]

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column is less than value.

    Parameters

    • column: string

      The column to filter on

    • value: unknown

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • lte<ColumnName>(column: ColumnName, value: Row[ColumnName]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • lte(column: string, value: unknown): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column is less than or equal to value.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • value: Row[ColumnName]

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column is less than or equal to value.

    Parameters

    • column: string

      The column to filter on

    • value: unknown

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • match<ColumnName>(query: Record<ColumnName, Row[ColumnName]>): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • match(query: Record<string, unknown>): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where each column in query keys is equal to its associated value. Shorthand for multiple .eq()s.

    Type Parameters

    • ColumnName extends string

    Parameters

    • query: Record<ColumnName, Row[ColumnName]>

      The object to filter with, with column names as keys mapped to their filter values

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where each column in query keys is equal to its associated value. Shorthand for multiple .eq()s.

    Parameters

    • query: Record<string, unknown>

      The object to filter with, with column names as keys mapped to their filter values

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • neq<ColumnName>(column: ColumnName, value: Row[ColumnName]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • neq(column: string, value: unknown): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows where column is not equal to value.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • value: Row[ColumnName]

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows where column is not equal to value.

    Parameters

    • column: string

      The column to filter on

    • value: unknown

      The value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • not<ColumnName>(column: ColumnName, operator: FilterOperator, value: Row[ColumnName]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • not(column: string, operator: string, value: unknown): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows which doesn't satisfy the filter.

    Unlike most filters, opearator and value are used as-is and need to follow PostgREST syntax. You also need to make sure they are properly sanitized.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to filter on

    • operator: FilterOperator

      The operator to be negated to filter with, following PostgREST syntax

    • value: Row[ColumnName]

      The value to filter with, following PostgREST syntax

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Match only rows which doesn't satisfy the filter.

    Unlike most filters, opearator and value are used as-is and need to follow PostgREST syntax. You also need to make sure they are properly sanitized.

    Parameters

    • column: string

      The column to filter on

    • operator: string

      The operator to be negated to filter with, following PostgREST syntax

    • value: unknown

      The value to filter with, following PostgREST syntax

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • or(filters: string, options?: { foreignTable?: string; referencedTable?: string }): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Match only rows which satisfy at least one of the filters.

    Unlike most filters, filters is used as-is and needs to follow PostgREST syntax. You also need to make sure it's properly sanitized.

    It's currently not possible to do an .or() filter across multiple tables.

    Parameters

    • filters: string

      The filters to use, following PostgREST syntax

    • options: { foreignTable?: string; referencedTable?: string } = {}

      Named parameters

      • Optional foreignTable?: string

        Deprecated, use referencedTable instead

      • Optional referencedTable?: string

        Set this to filter on referenced tables instead of the parent table

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • order<ColumnName>(column: ColumnName, options?: { ascending?: boolean; nullsFirst?: boolean; referencedTable?: undefined }): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • order(column: string, options?: { ascending?: boolean; nullsFirst?: boolean; referencedTable?: string }): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • order<ColumnName>(column: ColumnName, options?: { ascending?: boolean; foreignTable?: undefined; nullsFirst?: boolean }): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • order(column: string, options?: { ascending?: boolean; foreignTable?: string; nullsFirst?: boolean }): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Order the query result by column.

    You can call this method multiple times to order by multiple columns.

    You can order referenced tables, but it only affects the ordering of the parent table if you use !inner in the query.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to order by

    • Optional options: { ascending?: boolean; nullsFirst?: boolean; referencedTable?: undefined }

      Named parameters

      • Optional ascending?: boolean

        If true, the result will be in ascending order

      • Optional nullsFirst?: boolean

        If true, nulls appear first. If false, nulls appear last.

      • Optional referencedTable?: undefined

        Set this to order a referenced table by its columns

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Order the query result by column.

    You can call this method multiple times to order by multiple columns.

    You can order referenced tables, but it only affects the ordering of the parent table if you use !inner in the query.

    Parameters

    • column: string

      The column to order by

    • Optional options: { ascending?: boolean; nullsFirst?: boolean; referencedTable?: string }

      Named parameters

      • Optional ascending?: boolean

        If true, the result will be in ascending order

      • Optional nullsFirst?: boolean

        If true, nulls appear first. If false, nulls appear last.

      • Optional referencedTable?: string

        Set this to order a referenced table by its columns

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Order the query result by column.

    You can call this method multiple times to order by multiple columns.

    You can order referenced tables, but it only affects the ordering of the parent table if you use !inner in the query.

    deprecated

    Use options.referencedTable instead of options.foreignTable

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The column to order by

    • Optional options: { ascending?: boolean; foreignTable?: undefined; nullsFirst?: boolean }

      Named parameters

      • Optional ascending?: boolean
      • Optional foreignTable?: undefined
      • Optional nullsFirst?: boolean

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Order the query result by column.

    You can call this method multiple times to order by multiple columns.

    You can order referenced tables, but it only affects the ordering of the parent table if you use !inner in the query.

    deprecated

    Use options.referencedTable instead of options.foreignTable

    Parameters

    • column: string

      The column to order by

    • Optional options: { ascending?: boolean; foreignTable?: string; nullsFirst?: boolean }

      Named parameters

      • Optional ascending?: boolean
      • Optional foreignTable?: string
      • Optional nullsFirst?: boolean

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • overlaps<ColumnName>(column: ColumnName, value: string | readonly Row[ColumnName][]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • overlaps(column: string, value: string | readonly unknown[]): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Only relevant for array and range columns. Match only rows where column and value have an element in common.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The array or range column to filter on

    • value: string | readonly Row[ColumnName][]

      The array or range value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Only relevant for array and range columns. Match only rows where column and value have an element in common.

    Parameters

    • column: string

      The array or range column to filter on

    • value: string | readonly unknown[]

      The array or range value to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • range(from: number, to: number, options?: { foreignTable?: string; referencedTable?: string }): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Limit the query result by starting at an offset from and ending at the offset to. Only records within this range are returned. This respects the query order and if there is no order clause the range could behave unexpectedly. The from and to values are 0-based and inclusive: range(1, 3) will include the second, third and fourth rows of the query.

    Parameters

    • from: number

      The starting index from which to limit the result

    • to: number

      The last index to which to limit the result

    • options: { foreignTable?: string; referencedTable?: string } = {}

      Named parameters

      • Optional foreignTable?: string

        Deprecated, use options.referencedTable instead

      • Optional referencedTable?: string

        Set this to limit rows of referenced tables instead of the parent table

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • rangeAdjacent<ColumnName>(column: ColumnName, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • rangeAdjacent(column: string, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Only relevant for range columns. Match only rows where column is mutually exclusive to range and there can be no element between the two ranges.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Only relevant for range columns. Match only rows where column is mutually exclusive to range and there can be no element between the two ranges.

    Parameters

    • column: string

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • rangeGt<ColumnName>(column: ColumnName, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • rangeGt(column: string, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Only relevant for range columns. Match only rows where every element in column is greater than any element in range.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Only relevant for range columns. Match only rows where every element in column is greater than any element in range.

    Parameters

    • column: string

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • rangeGte<ColumnName>(column: ColumnName, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • rangeGte(column: string, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Only relevant for range columns. Match only rows where every element in column is either contained in range or greater than any element in range.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Only relevant for range columns. Match only rows where every element in column is either contained in range or greater than any element in range.

    Parameters

    • column: string

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • rangeLt<ColumnName>(column: ColumnName, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • rangeLt(column: string, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Only relevant for range columns. Match only rows where every element in column is less than any element in range.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Only relevant for range columns. Match only rows where every element in column is less than any element in range.

    Parameters

    • column: string

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • rangeLte<ColumnName>(column: ColumnName, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • rangeLte(column: string, range: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Only relevant for range columns. Match only rows where every element in column is either contained in range or less than any element in range.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Only relevant for range columns. Match only rows where every element in column is either contained in range or less than any element in range.

    Parameters

    • column: string

      The range column to filter on

    • range: string

      The range to filter with

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • select<Query, NewResultOne>(columns?: Query): PostgrestTransformBuilder<Schema, Row, NewResultOne[], RelationName, Relationships>
  • Perform a SELECT on the query result.

    By default, .insert(), .update(), .upsert(), and .delete() do not return modified rows. By calling this method, modified rows are returned in data.

    Type Parameters

    • Query extends string = "*"

    • NewResultOne = UnstableGetResult<Schema, Row, RelationName, Relationships, Query>

    Parameters

    • Optional columns: Query

      The columns to retrieve, separated by commas

    Returns PostgrestTransformBuilder<Schema, Row, NewResultOne[], RelationName, Relationships>

  • setHeader(name: string, value: string): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • textSearch<ColumnName>(column: ColumnName, query: string, options?: { config?: string; type?: "plain" | "phrase" | "websearch" }): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • textSearch(column: string, query: string, options?: { config?: string; type?: "plain" | "phrase" | "websearch" }): PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>
  • Only relevant for text and tsvector columns. Match only rows where column matches the query string in query.

    Type Parameters

    • ColumnName extends string

    Parameters

    • column: ColumnName

      The text or tsvector column to filter on

    • query: string

      The query text to match with

    • Optional options: { config?: string; type?: "plain" | "phrase" | "websearch" }

      Named parameters

      • Optional config?: string

        The text search configuration to use

      • Optional type?: "plain" | "phrase" | "websearch"

        Change how the query text is interpreted

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • Only relevant for text and tsvector columns. Match only rows where column matches the query string in query.

    Parameters

    • column: string

      The text or tsvector column to filter on

    • query: string

      The query text to match with

    • Optional options: { config?: string; type?: "plain" | "phrase" | "websearch" }

      Named parameters

      • Optional config?: string

        The text search configuration to use

      • Optional type?: "plain" | "phrase" | "websearch"

        Change how the query text is interpreted

    Returns PostgrestFilterBuilder<Schema, Row, Result, RelationName, Relationships>

  • then<TResult1, TResult2>(onfulfilled?: null | ((value: PostgrestSingleResponse<Result>) => TResult1 | PromiseLike<TResult1>), onrejected?: null | ((reason: any) => TResult2 | PromiseLike<TResult2>)): PromiseLike<TResult1 | TResult2>

Generated using TypeDoc