-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.idea/ | ||
node_modules/ | ||
coverage/ | ||
test/typescript/*.js | ||
test/typescript/*.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/// <reference path="../../typescript/pg-monitor.d.ts" /> | ||
|
||
import * as pgMonitor from "pg-monitor"; | ||
|
||
var options = {}; | ||
|
||
pgMonitor.attach(options, ['query'], true); | ||
|
||
pgMonitor.attach({ | ||
options: options, | ||
events: [], | ||
override: true | ||
}); | ||
|
||
pgMonitor.detach(); | ||
|
||
pgMonitor.log = function (msg, info) { | ||
info.display = false; | ||
}; | ||
|
||
pgMonitor.setTheme('matrix'); | ||
|
||
pgMonitor.setTheme({ | ||
time: null, | ||
value: null, | ||
cn: null, | ||
tx: null, | ||
paramTitle: null, | ||
errorTitle: null, | ||
query: null, | ||
special: null, | ||
error: null | ||
}); | ||
|
||
pgMonitor.detailed = false; | ||
|
||
pgMonitor.connect({}); | ||
pgMonitor.disconnect({}); | ||
pgMonitor.query({}); | ||
pgMonitor.task({}); | ||
pgMonitor.transact({}); | ||
pgMonitor.error('ops', {}, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
### TypeScript for pg-monitor | ||
|
||
Complete TypeScript declarations for [pg-monitor] version 0.5.0 or later. | ||
|
||
#### Usage | ||
|
||
```ts | ||
/// <reference path="node_modules/pg-monitor/typescript/pg-monitor.d.ts" /> | ||
|
||
import * as pgMonitor from "pg-monitor"; | ||
|
||
var pgOptions = { | ||
// Initialization Options object that's used for initializing pg-promise | ||
}; | ||
|
||
pgMonitor.attach(pgOptions); | ||
``` | ||
|
||
[pg-monitor]:https://github.com/vitaly-t/pg-monitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
//////////////////////////////////////// | ||
// Requires pg-monitor v0.5.0 or later. | ||
//////////////////////////////////////// | ||
|
||
declare module "pg-monitor" { | ||
|
||
interface ColorTheme { | ||
time:Function; | ||
value:Function; | ||
cn:Function; | ||
tx:Function; | ||
paramTitle:Function; | ||
errorTitle:Function; | ||
query:Function; | ||
special:Function; | ||
error:Function; | ||
} | ||
|
||
interface EventInfo { | ||
time:Date; | ||
text:string; | ||
event:string; | ||
display:boolean; | ||
} | ||
|
||
namespace pgMonitor { | ||
|
||
export function attach(options:Object, events?:Array<string>, override?:boolean):void; | ||
|
||
export function attach(options:{ | ||
options:Object, | ||
events?:Array<string>, | ||
override?:boolean | ||
}):void; | ||
|
||
export function detach():void; | ||
|
||
export function setTheme(theme:string|ColorTheme):void; | ||
|
||
export function log(msg:string, info:EventInfo):void; | ||
|
||
export var detailed:boolean; | ||
|
||
export function connect(client:Object, detailed?:boolean):void; | ||
|
||
export function disconnect(client:Object, detailed?:boolean):void; | ||
|
||
export function query(e:Object, detailed?:boolean):void; | ||
|
||
export function task(e:Object):void; | ||
|
||
export function transact(e:Object):void; | ||
|
||
export function error(err:any, e:Object, detailed?:boolean):void; | ||
|
||
} | ||
|
||
export = pgMonitor; | ||
} |