-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathindex.d.ts
86 lines (82 loc) · 2.39 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
declare namespace PostgresInterval {
export interface IPostgresInterval {
years: number;
months: number;
days: number;
hours: number;
minutes: number;
seconds: number;
milliseconds: number;
/**
* Returns an interval string. This allows the interval object to be passed into prepared statements.
*
* ```js
* var parse = require('postgres-interval')
* var interval = parse('01:02:03')
* // => { hours: 1, minutes: 2, seconds: 3 }
* interval.toPostgres()
* // 1 hour 2 minutes 3 seconds
* ```
*/
toPostgres(): string;
/**
* Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string, for example P0Y0M0DT0H9M0S.
*
* Also available as {@link toISOString toISOString}.
*
* ```js
* var parse = require('postgres-interval')
* var interval = parse('01:02:03')
* // => { hours: 1, minutes: 2, seconds: 3 }
* interval.toISO()
* // P0Y0M0DT1H2M3S
* ```
*/
toISO(): string;
/**
* Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string, for example P0Y0M0DT0H9M0S.
*
* Also available as {@link toISO toISO} for backwards compatibility.
*
* ```js
* var parse = require('postgres-interval')
* var interval = parse('01:02:03')
* // => { hours: 1, minutes: 2, seconds: 3 }
* interval.toISOString()
* // P0Y0M0DT1H2M3S
* ```
*/
toISOString(): string;
/**
* Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string shortened to minimum length, for example `PT9M`.
*
* ```js
* var parse = require('postgres-interval')
* var interval = parse('01:02:03')
* // => { hours: 1, minutes: 2, seconds: 3 }
* interval.toISOStringShort()
* // PT1H2M3S
* ```
*/
toISOStringShort(): string;
}
}
/**
* Parse Postgres interval columns.
*
* ```js
* var parse = require('postgres-interval')
* var interval = parse('01:02:03')
* // => { hours: 1, minutes: 2, seconds: 3 }
* interval.toPostgres()
* // 1 hour 2 minutes 3 seconds
* interval.toISOString()
* // P0Y0M0DT1H2M3S
* interval.toISOStringShort()
* // PT1H2M3S
* ```
*
* @param raw A Postgres interval string.
*/
declare function PostgresInterval(raw: string): PostgresInterval.IPostgresInterval;
export = PostgresInterval;