test-easy-psql
Version:
Welcome to the test-easy-psql documentation! test-easy-psql is a simple intermediary for querying data in PostgreSQL databases. Whether you're a beginner or an experienced developer, this documentation will help you get started with test-easy-psql and lev
98 lines (91 loc) • 2.34 kB
TypeScript
export = Postgres;
declare class Postgres {
connectionConfig: {
host?: string;
port?: string | number;
user?: string;
password?: string;
schema?: string;
database?: string;
min?: number;
max?: number;
};
relations?:
| Array<(typeof Relation)[]>
| Array<{
from_table: string;
from_column: string;
to_table: string;
to_column: string;
type: "object" | "array";
alias: string;
schema?: string;
}>;
options?: {
createFiles?: boolean;
skipIfDirectoryExists?: boolean;
dirname: string;
useESM: boolean;
extension: "js" | "mjs" | "ts";
};
constructor({
connectionConfig,
relations,
options,
}: {
connectionConfig: {
host?: string;
port?: string | number;
user?: string;
password?: string;
schema?: string;
database?: string;
min?: number;
max?: number;
};
relations?:
| Array<(typeof Relation)[]>
| Array<{
from_table: string;
from_column: string;
to_table: string;
to_column: string;
type: "object" | "array";
alias: string;
schema?: string;
}>;
options?: {
createFiles?: boolean;
skipIfDirectoryExists?: boolean;
dirname: string;
useESM: boolean;
extension: "js" | "mjs" | "ts";
};
});
init(): Promise<void>;
query(sql: string, args?: any[], connection?: any): Promise<any>;
model(
table: string,
connection?: any,
schema?: string
): {
find: Model["find"];
findOne: Model["findOne"];
create: Model["create"];
createMany: Model["createMany"];
createTX: Model["createTX"];
createManyTX: Model["createManyTX"];
update: Model["update"];
delete: Model["delete"];
aggregate: Model["aggregate"];
withTransaction: Model["withTransaction"];
select: Model["select"];
selectOne: Model["selectOne"];
instance: typeof Model;
};
enablePOSTGIS(value: boolean): void;
pool(): any;
withConnection(cb: (conn: any) => Promise<any | void>): Promise<any | void>;
}
import Relation = require("./relation");
import Model = require("./model");