PostgrestError

Class returned from PostgrestFetcher on non-2** response (Not exported)

new PostgrestError(error: any)
Parameters
error (any)
Instance Members
status
response
statusMsg
statusDetails
statusHint

PostgrestResponse

Class returned from PostgrestFetcher promise (not exported). *

new PostgrestResponse(response: any, page_size: any)
Parameters
response (any)
page_size (any)
Instance Members
status
headers
data

PostgrestFetcher

Fetches Postgrest results.

new PostgrestFetcher(config: Object)
Parameters
config (Object = {})
Name Description
config.count Boolean (default true) request Postgrest run a seperate count query and return it in the results
config.debug Boolean (default false) extra debugging info sent to logger
config.log function (default console.log) logging function
config.warn function (default console.warn) warning function
Example
import Fetcher from 'js-postgrest/lib/PostgrestFetcher'
const fetcher = new Fetcher()
const host = 'https://postgrest-test.chessindex.org'
const default_q = '/testing?limit=5'
const results = await fetcher.get(host + default_q)
  .then(response => {console.log('fetched:', href); return response})
  .catch(error => {console.log('failed:', href); return error})
Instance Members
get(url, config)

PostgrestQuery

class to build up Postgrest Queries

new PostgrestQuery()
Example
import Query from 'js-postgrest/lib/PostgrestQuery'
import Fetcher from 'js-postgrest/lib/PostgrestFetcher'

const query = new Query()
query.paginate(1, 20)
query.op('eq', 'i', 4)

const conf = query.toConfig()
const search = query.toSearch()
const host = 'https://postgrest-test.chessindex.org'
const table = '/testing'

const results = await fetcher.get(host + table + search, conf)
  .then(response => {console.log('fetched:', href); return response})
  .catch(error => {console.log('failed:', href); return error})
Static Members
supported_ops
Instance Members
toSearch()
toConfig()
clear()
order(column, asc, nulls_last)
paginate(page, limit)
argument(name, value)
raw(value, the)
combine(other)
op(opname, name, value, not)
limit(number)
offset(number)