mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Add pg-connection-string.
This commit is contained in:
+17
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user