@tealbase/postgres-js
Version:
Isomorphic PostgREST client
41 lines • 1.14 kB
TypeScript
import { PostgrestBuilder, PostgrestQueryBuilder } from './builder';
export declare class PostgrestClient {
url: string;
headers: {
[key: string]: string;
};
schema?: string;
/**
* Creates a PostgREST client.
*
* @param url URL of the PostgREST endpoint.
* @param headers Custom headers.
* @param schema Postgres schema to switch to.
*/
constructor(url: string, { headers, schema }?: {
headers?: {
[key: string]: string;
};
schema?: string;
});
/**
* Authenticates the request with JWT.
*
* @param token The JWT token to use.
*/
auth(token: string): this;
/**
* Perform a table operation.
*
* @param table The table name to operate on.
*/
from<T = any>(table: string): PostgrestQueryBuilder<T>;
/**
* Perform a stored procedure call.
*
* @param fn The function name to call.
* @param params The parameters to pass to the function call.
*/
rpc<T = any>(fn: string, params?: object): PostgrestBuilder<T>;
}
//# sourceMappingURL=index.d.ts.map