Fix lint and test errors

This commit is contained in:
clarenceh
2017-06-10 14:37:53 +08:00
parent 89da66a28b
commit 09a3e2fa0e
2 changed files with 5 additions and 29 deletions
+5 -20
View File
@@ -1,8 +1,9 @@
// Type definitions for massive 3.0.0-rc1
// Type definitions for massive 3.0
// Project: https://github.com/dmfay/massive-js.git
// Definitions by: Pascal Birchler <https://github.com/swissspidy>
// Clarence Ho <https://github.com/clarenceh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
@@ -14,9 +15,7 @@ declare function massive(
driverConfig?: object): Promise<massive.Database>;
declare namespace massive {
export interface ConnectionInfo {
interface ConnectionInfo {
user?: string;
database?: string;
password?: string | null;
@@ -25,33 +24,19 @@ declare namespace massive {
ssl?: boolean;
application_name?: string;
fallback_application_name?: boolean;
}
export interface Database {
attach(ctor: any, ...sources: Array<any>): Promise<any>;
interface Database {
attach(ctor: any, ...sources: any[]): Promise<any>;
detach(entity: string, collection: string): void;
reload(): void;
query(query: any, params: any, options: any): Promise<any>;
saveDoc(collection: any, doc: any): any;
createDocumentTable(path: any): Promise<any>;
getObject(path: any, collection: any): object;
dropTable(table: string, options: any): void;
createSchema(schemaName: string): void;
dropSchema(schemaName: string, options: any): void;
[name: string]: any;
}
}
-9
View File
@@ -2,18 +2,9 @@ import massive = require('massive');
let dbconn: massive.Database;
function findUserById(id: number): Promise<any> {
return dbconn.users.findOne({id: id});
}
massive('postgres://app:password@localhost:5432/app').then( db => {
console.log(`DB connected successfully`);
dbconn = db;
}).catch(err => {
console.error(`Error connecting DB`);
});