├── .gitignore ├── .npmignore ├── .travis.yml ├── README.md ├── .bithoundrc ├── example.js ├── utilities.js ├── package.json ├── LICENSE └── .eslintrc.yml /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 6 4 | - 8 5 | - 9 6 | - 10 7 | script: 8 | - npm test 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # node-pgsql-utilities 2 | Utilities for pgsql node.js driver with specialized result types, introspection and other helpful functionality 3 | -------------------------------------------------------------------------------- /.bithoundrc: -------------------------------------------------------------------------------- 1 | { 2 | "critics": { 3 | "lint": { 4 | "engine": "eslint" 5 | }, 6 | "wc": { 7 | "limit": 40000 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /example.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const pg = require('pg'); 4 | const pgUtilities = require('./utilities'); 5 | 6 | console.dir({ 7 | pg, 8 | pgUtilities, 9 | }); 10 | -------------------------------------------------------------------------------- /utilities.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const upgrade = (connection) => { 4 | 5 | if (!connection._mixedUpgrade) { 6 | connection._mixedUpgrade = true; 7 | connection.slowTime = 2000; 8 | } 9 | 10 | }; 11 | 12 | const introspection = (connection) => { 13 | 14 | if (!connection._mixedIntrospection) { 15 | connection._mixedIntrospection = true; 16 | } 17 | 18 | }; 19 | 20 | module.exports = { 21 | upgrade, 22 | introspection, 23 | }; 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pgsql-utilities", 3 | "version": "0.0.2", 4 | "author": "Timur Shemsedinov ", 5 | "description": "Utilities for node.js PostgreSQL driver with specialized result types, introspection and other helpful functionality", 6 | "license": "MIT", 7 | "keywords": [ 8 | "pgsql", 9 | "utilities", 10 | "introspection", 11 | "impress" 12 | ], 13 | "readmeFilename": "README.md", 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/tshemsedinov/node-pgsql-utilities" 17 | }, 18 | "main": "./utilities", 19 | "scripts": { 20 | "test": "npm run lint && node example", 21 | "lint": "eslint ." 22 | }, 23 | "engines": { 24 | "node": ">= 6.0" 25 | }, 26 | "dependencies": { 27 | "pg": "^7.4.3" 28 | }, 29 | "devDependencies": { 30 | "eslint": "^4.15.0" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Metarhia contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | env: 2 | es6: true 3 | node: true 4 | extends: 'eslint:recommended' 5 | globals: 6 | api: false 7 | rules: 8 | indent: 9 | - error 10 | - 2 11 | - SwitchCase: 1 12 | VariableDeclarator: 13 | var: 2 14 | let: 2 15 | const: 3 16 | MemberExpression: 1 17 | linebreak-style: 18 | - error 19 | - unix 20 | quotes: 21 | - error 22 | - single 23 | semi: 24 | - error 25 | - always 26 | eqeqeq: 27 | - error 28 | - always 29 | no-loop-func: 30 | - error 31 | strict: 32 | - error 33 | - global 34 | block-spacing: 35 | - error 36 | - always 37 | brace-style: 38 | - error 39 | - 1tbs 40 | - allowSingleLine: true 41 | camelcase: 42 | - error 43 | comma-style: 44 | - error 45 | - last 46 | comma-spacing: 47 | - error 48 | - before: false 49 | after: true 50 | eol-last: 51 | - error 52 | func-call-spacing: 53 | - error 54 | - never 55 | key-spacing: 56 | - error 57 | - beforeColon: false 58 | afterColon: true 59 | mode: minimum 60 | keyword-spacing: 61 | - error 62 | - before: true 63 | after: true 64 | overrides: 65 | function: 66 | after: false 67 | max-len: 68 | - error 69 | - code: 80 70 | ignoreUrls: true 71 | max-nested-callbacks: 72 | - error 73 | - max: 7 74 | new-cap: 75 | - error 76 | - newIsCap: true 77 | capIsNew: true 78 | properties: true 79 | new-parens: 80 | - error 81 | no-lonely-if: 82 | - error 83 | no-trailing-spaces: 84 | - error 85 | no-unneeded-ternary: 86 | - error 87 | no-whitespace-before-property: 88 | - error 89 | object-curly-spacing: 90 | - error 91 | - always 92 | operator-assignment: 93 | - error 94 | - always 95 | operator-linebreak: 96 | - error 97 | - after 98 | semi-spacing: 99 | - error 100 | - before: false 101 | after: true 102 | space-before-blocks: 103 | - error 104 | - always 105 | space-before-function-paren: 106 | - error 107 | - never 108 | space-in-parens: 109 | - error 110 | - never 111 | space-infix-ops: 112 | - error 113 | space-unary-ops: 114 | - error 115 | - words: true 116 | nonwords: false 117 | overrides: 118 | typeof: false 119 | no-unreachable: 120 | - error 121 | no-global-assign: 122 | - error 123 | no-self-compare: 124 | - error 125 | no-unmodified-loop-condition: 126 | - error 127 | no-constant-condition: 128 | - error 129 | - checkLoops: false 130 | no-console: 131 | - off 132 | no-useless-concat: 133 | - error 134 | no-useless-escape: 135 | - error 136 | no-shadow-restricted-names: 137 | - error 138 | no-use-before-define: 139 | - error 140 | - functions: false 141 | arrow-body-style: 142 | - error 143 | - as-needed 144 | arrow-spacing: 145 | - error 146 | no-confusing-arrow: 147 | - error 148 | - allowParens: true 149 | no-useless-computed-key: 150 | - error 151 | no-useless-rename: 152 | - error 153 | no-var: 154 | - error 155 | object-shorthand: 156 | - error 157 | - always 158 | prefer-arrow-callback: 159 | - error 160 | prefer-const: 161 | - error 162 | prefer-numeric-literals: 163 | - error 164 | prefer-rest-params: 165 | - error 166 | prefer-spread: 167 | - error 168 | rest-spread-spacing: 169 | - error 170 | - never 171 | template-curly-spacing: 172 | - error 173 | - never 174 | --------------------------------------------------------------------------------