0.1.0
Class returned from PostgrestFetcher on non-2** response (Not exported)
(any)
Class returned from PostgrestFetcher promise (not exported). *
(any)
(any)
Fetches Postgrest results.
(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 |
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})
class to build up Postgrest Queries
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})
postgrest suppported operators
any
:
url search part of query
removes params
call a rpc type GET call (function must be marked immutable). http://postgrest.org/en/v5.1/api.html#immutable-and-stable-functions
combine the params of another instance to this instance
(PostgrestQuery)