# SupabaseQueryBuilder | @supabase/supabase-js
Documentation for @supabase/supabase-js

### Type Parameters

- #### T

### Hierarchy

- default<T>
  - SupabaseQueryBuilder

## Index

### Constructors

- constructor

### Properties

- _headers
- _realtime
- _schema
- _subscription
- _table
- allowEmpty
- body
- fetch
- headers
- method
- schema
- shouldThrowOnError
- signal
- url

### Methods

- delete
- insert
- on
- select
- then
- throwOnError
- update
- upsert

## Constructors

### constructor

- new SupabaseQueryBuilder<T>(url: string, __namedParameters: { fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>); headers?: GenericObject ; realtime: RealtimeClient ; schema: string; shouldThrowOnError?: boolean; table: string }): SupabaseQueryBuilder <T>

- Overrides PostgrestQueryBuilder<T>.constructor

  - Defined in src/lib/SupabaseQueryBuilder.ts:13

  #### Type Parameters

  - #### T

  #### Parameters

  - ##### url: string

  - ##### __namedParameters: { fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>); headers?: GenericObject ; realtime: RealtimeClient ; schema: string; shouldThrowOnError?: boolean; table: string }

    - ##### Optional fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>)

      - - (input: RequestInfo | URL, init?: RequestInit): Promise<Response>

        - #### Parameters

          - ##### input: RequestInfo | URL

          - ##### Optional init: RequestInit

          #### Returns Promise<Response>

    - ##### Optional headers?: GenericObject

    - ##### realtime: RealtimeClient

    - ##### schema: string

    - ##### Optional shouldThrowOnError?: boolean

    - ##### table: string

  #### Returns SupabaseQueryBuilder <T>

## Properties

### Private _headers

_headers: GenericObject

- Defined in src/lib/SupabaseQueryBuilder.ts:9

### Private _realtime

_realtime: RealtimeClient

- Defined in src/lib/SupabaseQueryBuilder.ts:8

### Private _schema

_schema: string

- Defined in src/lib/SupabaseQueryBuilder.ts:10

### Private _subscription

_subscription: null | SupabaseRealtimeClient = null

- Defined in src/lib/SupabaseQueryBuilder.ts:7

### Private _table

_table: string

- Defined in src/lib/SupabaseQueryBuilder.ts:11

### Protected allowEmpty

allowEmpty: boolean

Inherited from PostgrestQueryBuilder.allowEmpty

- Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:53

### Protected Optional body

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

Inherited from PostgrestQueryBuilder.body

- Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:49

### Protected fetch

fetch: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>)

Inherited from PostgrestQueryBuilder.fetch

- Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:52

#### Type declaration

- - (input: RequestInfo | URL, init?: RequestInit): Promise<Response>

  - #### Parameters

    - ##### input: RequestInfo | URL

    - ##### Optional init: RequestInit

    #### Returns Promise<Response>

### Protected headers

headers: {}

Inherited from PostgrestQueryBuilder.headers

- Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:45

#### Type declaration

- ##### [key: string]: string

### Protected method

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

Inherited from PostgrestQueryBuilder.method

- Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:43

### Protected Optional schema

schema?: string

Inherited from PostgrestQueryBuilder.schema

- Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:48

### Protected shouldThrowOnError

shouldThrowOnError: boolean

Inherited from PostgrestQueryBuilder.shouldThrowOnError

- Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:50

### Protected Optional signal

signal?: AbortSignal

Inherited from PostgrestQueryBuilder.signal

- Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:51

### Protected url

url: URL

Inherited from PostgrestQueryBuilder.url

- Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:44

## Methods

### delete

- delete(__namedParameters?: { count?: null | "exact" | "planned" | "estimated"; returning?: "minimal" | "representation" }): default<T>

- Inherited from PostgrestQueryBuilder.delete

  - Defined in node_modules/@supabase/postgrest-js/dist/module/lib/PostgrestQueryBuilder.d.ts:75

  Performs a DELETE on the table.

  #### Parameters

  - ##### Optional __namedParameters: { count?: null | "exact" | "planned" | "estimated"; returning?: "minimal" | "representation" }

    - ##### Optional count?: null | "exact" | "planned" | "estimated"

    - ##### Optional returning?: "minimal" | "representation"

  #### Returns default<T>

### insert

- insert(values: Partial<T> | Partial<T>[], options?: { count?: null | "exact" | "planned" | "estimated"; returning?: "minimal" | "representation" }): default<T>
- insert(values: Partial<T> | Partial<T>[], options?: { count?: null | "exact" | "planned" | "estimated"; onConflict?: string; returning?: "minimal" | "representation"; upsert?: boolean }): default<T>

- Inherited from PostgrestQueryBuilder.insert

  - Defined in node_modules/@supabase/postgrest-js/dist/module/lib/PostgrestQueryBuilder.d.ts:30

  Performs an INSERT into the table.

  #### Parameters

  - ##### values: Partial<T> | Partial<T>[]

    The values to insert.

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

    - ##### Optional count?: null | "exact" | "planned" | "estimated"

    - ##### Optional returning?: "minimal" | "representation"

  #### Returns default<T>

- Inherited from PostgrestQueryBuilder.insert

  - Defined in node_modules/@supabase/postgrest-js/dist/module/lib/PostgrestQueryBuilder.d.ts:37
  deprecated

    Use `upsert()` instead.

  #### Parameters

  - ##### values: Partial<T> | Partial<T>[]

  - ##### Optional options: { count?: null | "exact" | "planned" | "estimated"; onConflict?: string; returning?: "minimal" | "representation"; upsert?: boolean }

    - ##### Optional count?: null | "exact" | "planned" | "estimated"

    - ##### Optional onConflict?: string

    - ##### Optional returning?: "minimal" | "representation"

    - ##### Optional upsert?: boolean

  #### Returns default<T>

### on

- on(event: SupabaseEventTypes, callback: ((payload: SupabaseRealtimePayload <T>) => void)): SupabaseRealtimeClient

- - Defined in src/lib/SupabaseQueryBuilder.ts:44

  Subscribe to realtime changes in your database.

  #### Parameters

  - ##### event: SupabaseEventTypes

    The database event which you would like to receive updates for, or you can use the special wildcard `*` to listen to all changes.

  - ##### callback: ((payload: SupabaseRealtimePayload <T>) => void)

    A callback that will handle the payload that is sent whenever your database changes.

    - - (payload: SupabaseRealtimePayload <T>): void

      - #### Parameters

        - ##### payload: SupabaseRealtimePayload <T>

        #### Returns void

  #### Returns SupabaseRealtimeClient

### select

- select(columns?: string, __namedParameters?: { count?: null | "exact" | "planned" | "estimated"; head?: boolean }): default<T>

- Inherited from PostgrestQueryBuilder.select

  - Defined in node_modules/@supabase/postgrest-js/dist/module/lib/PostgrestQueryBuilder.d.ts:19

  Performs vertical filtering with SELECT.

  #### Parameters

  - ##### Optional columns: string

    The columns to retrieve, separated by commas.

  - ##### Optional __namedParameters: { count?: null | "exact" | "planned" | "estimated"; head?: boolean }

    - ##### Optional count?: null | "exact" | "planned" | "estimated"

    - ##### Optional head?: boolean

  #### Returns default<T>

### then

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

- Inherited from PostgrestQueryBuilder.then

  - Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:62

  #### Type Parameters

  - #### TResult1 = PostgrestResponse <T>

  - #### TResult2 = never

  #### Parameters

  - ##### Optional onfulfilled: null | ((value: PostgrestResponse <T>) => TResult1 | PromiseLike<TResult1>)

  - ##### Optional onrejected: null | ((reason: any) => TResult2 | PromiseLike<TResult2>)

  #### Returns PromiseLike<TResult1 | TResult2>

### throwOnError

- throwOnError(throwOnError?: boolean): SupabaseQueryBuilder <T>

- Inherited from PostgrestQueryBuilder.throwOnError

  - Defined in node_modules/@supabase/postgrest-js/dist/module/lib/types.d.ts:61

  If there's an error with the query, throwOnError will reject the promise by throwing the error instead of returning it as part of a successful response.

  https://github.com/supabase/supabase-js/issues/92

  #### Parameters

  - ##### Optional throwOnError: boolean

  #### Returns SupabaseQueryBuilder <T>

### update

- update(values: Partial<T>, __namedParameters?: { count?: null | "exact" | "planned" | "estimated"; returning?: "minimal" | "representation" }): default<T>

- Inherited from PostgrestQueryBuilder.update

  - Defined in node_modules/@supabase/postgrest-js/dist/module/lib/PostgrestQueryBuilder.d.ts:65

  Performs an UPDATE on the table.

  #### Parameters

  - ##### values: Partial<T>

    The values to update.

  - ##### Optional __namedParameters: { count?: null | "exact" | "planned" | "estimated"; returning?: "minimal" | "representation" }

    - ##### Optional count?: null | "exact" | "planned" | "estimated"

    - ##### Optional returning?: "minimal" | "representation"

  #### Returns default<T>

### upsert

- upsert(values: Partial<T> | Partial<T>[], __namedParameters?: { count?: null | "exact" | "planned" | "estimated"; ignoreDuplicates?: boolean; onConflict?: string; returning?: "minimal" | "representation" }): default<T>

- Inherited from PostgrestQueryBuilder.upsert

  - Defined in node_modules/@supabase/postgrest-js/dist/module/lib/PostgrestQueryBuilder.d.ts:52

  Performs an UPSERT into the table.

  #### Parameters

  - ##### values: Partial<T> | Partial<T>[]

    The values to insert.

  - ##### Optional __namedParameters: { count?: null | "exact" | "planned" | "estimated"; ignoreDuplicates?: boolean; onConflict?: string; returning?: "minimal" | "representation" }

    - ##### Optional count?: null | "exact" | "planned" | "estimated"

    - ##### Optional ignoreDuplicates?: boolean

    - ##### Optional onConflict?: string

    - ##### Optional returning?: "minimal" | "representation"

  #### Returns default<T>

Generated using TypeDoc