Class PostgrestBuilder<ClientOptions, Result, ThrowOnError>Abstract

Type Parameters

Hierarchy

Implements

Constructors

  • Type Parameters

    Parameters

    • builder: {
          body?: unknown;
          fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>);
          headers: HeadersInit;
          isMaybeSingle?: boolean;
          method: "GET" | "HEAD" | "POST" | "PATCH" | "DELETE";
          schema?: string;
          shouldThrowOnError?: boolean;
          signal?: AbortSignal;
          url: URL;
      }
      • Optional body?: unknown
      • 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>

      • headers: HeadersInit
      • Optional isMaybeSingle?: boolean
      • method: "GET" | "HEAD" | "POST" | "PATCH" | "DELETE"
      • Optional schema?: string
      • Optional shouldThrowOnError?: boolean
      • Optional signal?: AbortSignal
      • url: URL

    Returns PostgrestBuilder<ClientOptions, Result, ThrowOnError>

Properties

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

Type declaration

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

      • input: RequestInfo | URL
      • Optional init: RequestInit

      Returns Promise<Response>

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

Methods

  • Override the type of the returned data field in the response.

    Example

    // Merge with existing types (default behavior)
    const query = supabase
    .from('users')
    .select()
    .overrideTypes<{ custom_field: string }>()

    // Replace existing types completely
    const replaceQuery = supabase
    .from('users')
    .select()
    .overrideTypes<{ id: number; name: string }, { merge: false }>()

    Returns

    A PostgrestBuilder instance with the new type

    Type Parameters

    • NewResult

      The new type to cast the response data to

    • Options extends {
          merge?: boolean;
      } = {
          merge: true;
      }

      Optional type configuration (defaults to { merge: true })

    Returns PostgrestBuilder<ClientOptions, IsValidResultOverride<Result, NewResult, false, false> extends true ? ContainsNull<Result> extends true ? null | MergePartialResult<NewResult, NonNullable<Result>, Options> : MergePartialResult<NewResult, Result, Options> : CheckMatchingArrayTypes<Result, NewResult>, ThrowOnError>

  • Override the type of the returned data.

    Deprecated

    Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead

    Type Parameters

    • NewResult

      The new result type to override with

    Returns PostgrestBuilder<ClientOptions, CheckMatchingArrayTypes<Result, NewResult>, ThrowOnError>

Generated using TypeDoc