@fortress-js/node
Version:
The Fortress Backend SDK
39 lines (38 loc) • 1.6 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostgresClient = exports.PostgresConnection = void 0;
const pg_1 = require("pg");
class PostgresConnection extends pg_1.Connection {
}
exports.PostgresConnection = PostgresConnection;
class PostgresClient {
constructor(host, port, user, password, databaseName) {
this.host = host;
this.port = port;
this.user = user;
this.password = password;
this.databaseName = databaseName;
}
connect() {
return __awaiter(this, void 0, void 0, function* () {
return new PostgresConnection({
host: this.host,
port: this.port,
user: this.user,
password: this.password,
database: this.databaseName,
ssl: true,
});
});
}
}
exports.PostgresClient = PostgresClient;