Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PostgrestClient

Hierarchy

  • PostgrestClient

Index

Constructors

Properties

Methods

Constructors

constructor

  • new PostgrestClient(url: string, __namedParameters?: { fetch: undefined | fetch; headers: {}; schema: undefined | string; throwOnError: undefined | false | true }): PostgrestClient
  • Creates a PostgREST client.

    Parameters

    • url: string

      URL of the PostgREST endpoint.

    • Default value __namedParameters: { fetch: undefined | fetch; headers: {}; schema: undefined | string; throwOnError: undefined | false | true } = {}
      • fetch: undefined | fetch
      • headers: {}

        Custom headers.

        • [key: string]: string
      • schema: undefined | string

        Postgres schema to switch to.

      • throwOnError: undefined | false | true

    Returns PostgrestClient

Properties

Optional fetch

fetch: Fetch

headers

headers: {}

Type declaration

  • [key: string]: string

Optional schema

schema: undefined | string

Optional shouldThrowOnError

shouldThrowOnError: undefined | false | true

url

url: string

Methods

auth

  • auth(token: string): this
  • Authenticates the request with JWT.

    Parameters

    • token: string

      The JWT token to use.

    Returns this

from

rpc

  • rpc<T>(fn: string, params?: undefined | object, __namedParameters?: { count: null | "exact" | "planned" | "estimated"; head: boolean }): PostgrestFilterBuilder<T>
  • Perform a function call.

    Type parameters

    • T = any

    Parameters

    • fn: string

      The function name to call.

    • Optional params: undefined | object

      The parameters to pass to the function call.

    • 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, no data will be returned.

    Returns PostgrestFilterBuilder<T>

Generated using TypeDoc