Add pg-connection-string.

This commit is contained in:
Bradley Ayers
2017-07-16 20:07:43 +10:00
parent ababb9cd46
commit a4ef6371cd
4 changed files with 53 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for pg-connection-string 0.1
// Project: https://github.com/iceddev/pg-connection-string
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export function parse(connectionString: string): {
host: string;
database: string;
port: string;
application_name?: string;
client_encoding?: string;
fallback_application_name?: string;
user?: string;
password?: string;
ssl?: boolean;
};
@@ -0,0 +1,13 @@
import { parse } from 'pg-connection-string';
const parts = parse('postgres://user:password@host:port/dbname');
parts.application_name;
parts.client_encoding;
parts.database;
parts.fallback_application_name;
parts.host;
parts.password;
parts.port;
parts.ssl;
parts.user;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"pg-connection-string-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }