Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • T

Hierarchy

Implements

Index

Constructors

constructor

  • new PostgrestQueryBuilder(url: string, __namedParameters?: { fetch: undefined | fetch; headers: {}; schema: undefined | string; shouldThrowOnError: undefined | false | true }): PostgrestQueryBuilder

Properties

Protected allowEmpty

allowEmpty: boolean

Protected Optional body

body: Partial<T> | Partial<T>[]

Protected fetch

fetch: Fetch

Protected headers

headers: {}

Type declaration

  • [key: string]: string

Protected method

method: "GET" | "HEAD" | "POST" | "PATCH" | "DELETE"

Protected Optional schema

schema: undefined | string

Protected shouldThrowOnError

shouldThrowOnError: boolean

Protected Optional signal

signal: AbortSignal

Protected url

url: URL

Methods

delete

  • delete(__namedParameters?: { count: null | "exact" | "planned" | "estimated"; returning: "minimal" | "representation" }): PostgrestFilterBuilder<T>
  • Performs a DELETE on the table.

    Parameters

    • Default value __namedParameters: { count: null | "exact" | "planned" | "estimated"; returning: "minimal" | "representation" } = {}
      • count: null | "exact" | "planned" | "estimated"

        Count algorithm to use to count rows in a table.

      • returning: "minimal" | "representation"

        If true, return the deleted row(s) in the response.

    Returns PostgrestFilterBuilder<T>

insert

  • insert(values: Partial<T> | Partial<T>[], options?: undefined | { count?: null | "exact" | "planned" | "estimated"; returning?: "minimal" | "representation" }): PostgrestFilterBuilder<T>
  • insert(values: Partial<T> | Partial<T>[], options?: undefined | { count?: null | "exact" | "planned" | "estimated"; onConflict?: undefined | string; returning?: "minimal" | "representation"; upsert?: undefined | false | true }): PostgrestFilterBuilder<T>
  • Performs an INSERT into the table.

    Parameters

    • values: Partial<T> | Partial<T>[]

      The values to insert.

    • Optional options: undefined | { count?: null | "exact" | "planned" | "estimated"; returning?: "minimal" | "representation" }

    Returns PostgrestFilterBuilder<T>

  • deprecated

    Use upsert() instead.

    Parameters

    • values: Partial<T> | Partial<T>[]
    • Optional options: undefined | { count?: null | "exact" | "planned" | "estimated"; onConflict?: undefined | string; returning?: "minimal" | "representation"; upsert?: undefined | false | true }

    Returns PostgrestFilterBuilder<T>

select

  • select(columns?: string, __namedParameters?: { count: null | "exact" | "planned" | "estimated"; head: boolean }): PostgrestFilterBuilder<T>
  • Performs vertical filtering with SELECT.

    Parameters

    • Default value columns: string = "*"

      The columns to retrieve, separated by commas.

    • Default value __namedParameters: { count: null | "exact" | "planned" | "estimated"; head: boolean } = {}
      • count: null | "exact" | "planned" | "estimated"

        Count algorithm to use to count rows in a table.

      • head: boolean

        When set to true, select will void data.

    Returns PostgrestFilterBuilder<T>

then

  • then<TResult1, TResult2>(onfulfilled?: ((value: PostgrestResponse<T>) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>
  • Type parameters

    • TResult1 = PostgrestResponse<T>

    • TResult2 = never

    Parameters

    • Optional onfulfilled: ((value: PostgrestResponse<T>) => TResult1 | PromiseLike<TResult1>) | undefined | null
    • Optional onrejected: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null

    Returns PromiseLike<TResult1 | TResult2>

throwOnError

  • throwOnError(throwOnError?: undefined | false | true): this

update

  • update(values: Partial<T>, __namedParameters?: { count: null | "exact" | "planned" | "estimated"; returning: "minimal" | "representation" }): PostgrestFilterBuilder<T>
  • Performs an UPDATE on the table.

    Parameters

    • values: Partial<T>

      The values to update.

    • Default value __namedParameters: { count: null | "exact" | "planned" | "estimated"; returning: "minimal" | "representation" } = {}
      • count: null | "exact" | "planned" | "estimated"

        Count algorithm to use to count rows in a table.

      • returning: "minimal" | "representation"

        By default the updated record is returned. Set this to 'minimal' if you don't need this value.

    Returns PostgrestFilterBuilder<T>

upsert

  • upsert(values: Partial<T> | Partial<T>[], __namedParameters?: { count: null | "exact" | "planned" | "estimated"; ignoreDuplicates: boolean; onConflict: undefined | string; returning: "minimal" | "representation" }): PostgrestFilterBuilder<T>
  • Performs an UPSERT into the table.

    Parameters

    • values: Partial<T> | Partial<T>[]

      The values to insert.

    • Default value __namedParameters: { count: null | "exact" | "planned" | "estimated"; ignoreDuplicates: boolean; onConflict: undefined | string; returning: "minimal" | "representation" } = {}
      • count: null | "exact" | "planned" | "estimated"

        Count algorithm to use to count rows in a table.

      • ignoreDuplicates: boolean

        Specifies if duplicate rows should be ignored and not inserted.

      • onConflict: undefined | string

        By specifying the on_conflict query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint.

      • returning: "minimal" | "representation"

        By default the new record is returned. Set this to 'minimal' if you don't need this value.

    Returns PostgrestFilterBuilder<T>

Generated using TypeDoc