source: node_modules/pg/lib/defaults.js@ 62b2964

finki-main main
Last change on this file since 62b2964 was 62b2964, checked in by Klimentina Efremova <klimentina08642@…>, 2 weeks ago

Project Handcraft Marketplace

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[62b2964]1'use strict'
2
3let user
4try {
5 user = process.platform === 'win32' ? process.env.USERNAME : process.env.USER
6} catch {
7 // ignore, e.g., Deno without --allow-env
8}
9
10module.exports = {
11 // database host. defaults to localhost
12 host: 'localhost',
13
14 // database user's name
15 user,
16
17 // name of database to connect
18 database: undefined,
19
20 // database user's password
21 password: null,
22
23 // a Postgres connection string to be used instead of setting individual connection items
24 // NOTE: Setting this value will cause it to override any other value (such as database or user) defined
25 // in the defaults object.
26 connectionString: undefined,
27
28 // database port
29 port: 5432,
30
31 // number of rows to return at a time from a prepared statement's
32 // portal. 0 will return all rows at once
33 rows: 0,
34
35 // binary result mode
36 binary: false,
37
38 // Connection pool options - see https://github.com/brianc/node-pg-pool
39
40 // number of connections to use in connection pool
41 // 0 will disable connection pooling
42 max: 10,
43
44 // max milliseconds a client can go unused before it is removed
45 // from the pool and destroyed
46 idleTimeoutMillis: 30000,
47
48 client_encoding: '',
49
50 ssl: false,
51
52 // SSL negotiation style: 'postgres' (traditional SSLRequest) or 'direct'
53 sslnegotiation: undefined,
54
55 application_name: undefined,
56
57 fallback_application_name: undefined,
58
59 options: undefined,
60
61 parseInputDatesAsUTC: false,
62
63 // max milliseconds any query using this connection will execute for before timing out in error.
64 // false=unlimited
65 statement_timeout: false,
66
67 // Abort any statement that waits longer than the specified duration in milliseconds while attempting to acquire a lock.
68 // false=unlimited
69 lock_timeout: false,
70
71 // Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds
72 // false=unlimited
73 idle_in_transaction_session_timeout: false,
74
75 // max milliseconds to wait for query to complete (client side)
76 query_timeout: false,
77
78 connect_timeout: 0,
79
80 keepalives: 1,
81
82 keepalives_idle: 0,
83}
84
85const pgTypes = require('pg-types')
86// save default parsers
87const parseBigInteger = pgTypes.getTypeParser(20, 'text')
88const parseBigIntegerArray = pgTypes.getTypeParser(1016, 'text')
89
90// parse int8 so you can get your count values as actual numbers
91module.exports.__defineSetter__('parseInt8', function (val) {
92 pgTypes.setTypeParser(20, 'text', val ? pgTypes.getTypeParser(23, 'text') : parseBigInteger)
93 pgTypes.setTypeParser(1016, 'text', val ? pgTypes.getTypeParser(1007, 'text') : parseBigIntegerArray)
94})
Note: See TracBrowser for help on using the repository browser.