Skip to content

Commit cb42ac4

Browse files
committed
Code style preferences
1 parent 13c2c45 commit cb42ac4

10 files changed

+744
-711
lines changed

.editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# EditorConfig http://EditorConfig.org
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = tab
8+
insert_final_newline = true

.eslintrc.json

+25-23
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
{
2-
"env": {
3-
"node": true,
4-
"es2017": true
5-
},
6-
"rules": {
7-
"require-jsdoc": ["error", {
8-
"require": {
9-
"FunctionDeclaration": false,
10-
"MethodDefinition": false,
11-
"ClassDeclaration": false,
12-
"ArrowFunctionExpression": false
13-
}
14-
}],
15-
"comma-dangle": ["warn", "only-multiline"],
16-
"max-len": ["warn", 120],
17-
"object-curly-spacing": ["warn", "always"],
18-
"space-before-function-paren": ["warn", {
19-
"anonymous": "always",
20-
"named": "never",
21-
"asyncArrow": "always"
22-
}],
23-
"new-cap": "warn"
24-
}
2+
"env": {
3+
"node": true,
4+
"es2017": true
5+
},
6+
"rules": {
7+
"comma-dangle": ["warn", "always-multiline"],
8+
"indent": ["error", "tab"],
9+
"max-len": ["warn", 120],
10+
"new-cap": "warn",
11+
"object-curly-spacing": ["warn", "always"],
12+
"quotes": ["warn", "single", { "avoidEscape": true }],
13+
"require-jsdoc": ["error", {
14+
"require": {
15+
"FunctionDeclaration": false,
16+
"MethodDefinition": false,
17+
"ClassDeclaration": false,
18+
"ArrowFunctionExpression": false
19+
}
20+
}],
21+
"space-before-function-paren": ["warn", {
22+
"anonymous": "always",
23+
"named": "never",
24+
"asyncArrow": "always"
25+
}]
26+
}
2527
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.jshintrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"esversion": 8,
3+
"node": true,
4+
"multistr": true,
5+
"sub": true
6+
}
File renamed without changes.

locales/en-US/postgresql.html

+31-33
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
<script type="text/x-red" data-help-name="postgresql">
2-
<p><code>node-red-contrib-postgresql</code> 👾 is a Node-RED node allowing basic access to Postgres 🐘 database.</p>
3-
<p><code>msg.payload</code> will contain the result object of the query. It has the following properties:
4-
</p>
5-
<ul>
6-
<li> <i>command</i>: The sql command that was executed (e.g. "SELECT", "UPDATE", etc.)</li>
7-
<li> <i>rowCount</i>: The number of rows affected by the SQL statement</li>
8-
<li> <i>oid</i>: The oid returned</li>
9-
<li> <i>rows</i>: An array of rows</li>
10-
</ul>
11-
<p>Postgres implements a template engine allowing parameterized queries:</p>
12-
<pre>
13-
/* INTEGER id COLUMN */
14-
SELECT *
15-
FROM table
16-
WHERE id = {{ msg.id }}
17-
/* VARCHAR id COLUMN*/
18-
SELECT *
19-
FROM table
20-
WHERE id = '{{ msg.id }}'
21-
</pre>
22-
<br>
23-
<p>Pass parameters as an array in the msg.params object</p>
24-
<pre>
2+
<p><code>node-red-contrib-postgresql</code> 👾 is a Node-RED node allowing basic access to Postgres 🐘 database.</p>
3+
<p><code>msg.payload</code> will contain the result object of the query. It has the following properties:</p>
4+
<ul>
5+
<li><dfn>command</dfn>: The SQL command that was executed (e.g. "SELECT", "UPDATE", etc.)</li>
6+
<li><dfn>rowCount</dfn>: The number of rows affected by the SQL statement</li>
7+
<li><dfn>oid</dfn>: The oid returned</li>
8+
<li><dfn>rows</dfn>: An array of rows</li>
9+
</ul>
10+
<p>This node implements a template engine allowing parameterized queries:</p>
11+
<pre>
12+
/* INTEGER id COLUMN */
13+
SELECT *
14+
FROM table
15+
WHERE id = {{ msg.id }}
16+
/* VARCHAR id COLUMN*/
17+
SELECT *
18+
FROM table
19+
WHERE id = '{{ msg.id }}'
20+
</pre>
21+
<p>Pass parameters as an array in the <code>msg.params</code> object:</p>
22+
<pre>
2523
msg.params=[msg.id];
24+
/* INTEGER id COLUMN */
25+
SELECT *
26+
FROM table
27+
WHERE id = {{ msg.id }}
28+
/* VARCHAR id COLUMN*/
29+
SELECT *
30+
FROM table
31+
WHERE id = $1
32+
</pre>
2633

27-
/* INTEGER id COLUMN */
28-
SELECT *
29-
FROM table
30-
WHERE id = {{ msg.id }}
31-
/* VARCHAR id COLUMN*/
32-
SELECT *
33-
FROM table
34-
WHERE id = $1
35-
</pre>
36-
</script>
34+
</script>

locales/en-US/postgresql.json

+41-41
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
{
2-
"postgresql": {
3-
"label": {
4-
"name": "Name",
5-
"host": "Host",
6-
"port": "Port",
7-
"database": "Database",
8-
"ssl": "SSL",
9-
"user": "User",
10-
"password": "Password",
11-
"min": "Minimum size",
12-
"max": "Maximum size",
13-
"idle": "Idle Timeout",
14-
"connectionTimeout": "Connection Timeout",
15-
"server": "Server",
16-
"query": "Query",
17-
"split": "Split results in multiple messages",
18-
"rowsPerMsg": "Number of rows per message",
19-
"receiveOuput": "Receive output"
20-
},
21-
"placeholder": {
22-
"name": "dbConnection",
23-
"host": "127.0.0.1",
24-
"port": "5432",
25-
"database": "dbExample",
26-
"user": "dbUser",
27-
"password": "dbPassword",
28-
"min": "10",
29-
"max": "1",
30-
"idle": "1000 (Milliseconds)",
31-
"connectionTimeout": "10000 (Milliseconds)"
32-
},
33-
"tab": {
34-
"connection": "Connection",
35-
"security": "Security",
36-
"pool": "Pool"
37-
},
38-
"title": {
39-
"max": "Maximum number of physical database connections that this connection pool can contain.",
40-
"min": "Minimum number of physical database connections that this connection pool can contain."
41-
}
42-
}
2+
"postgresql": {
3+
"label": {
4+
"name": "Name",
5+
"host": "Host",
6+
"port": "Port",
7+
"database": "Database",
8+
"ssl": "SSL",
9+
"user": "User",
10+
"password": "Password",
11+
"min": "Minimum size",
12+
"max": "Maximum size",
13+
"idle": "Idle Timeout",
14+
"connectionTimeout": "Connection Timeout",
15+
"server": "Server",
16+
"query": "Query",
17+
"split": "Split results in multiple messages",
18+
"rowsPerMsg": "Number of rows per message",
19+
"receiveOuput": "Receive output"
20+
},
21+
"placeholder": {
22+
"name": "dbConnection",
23+
"host": "127.0.0.1",
24+
"port": "5432",
25+
"database": "dbExample",
26+
"user": "dbUser",
27+
"password": "dbPassword",
28+
"min": "10",
29+
"max": "1",
30+
"idle": "1000 (Milliseconds)",
31+
"connectionTimeout": "10000 (Milliseconds)"
32+
},
33+
"tab": {
34+
"connection": "Connection",
35+
"security": "Security",
36+
"pool": "Pool"
37+
},
38+
"title": {
39+
"max": "Maximum number of physical database connections that this connection pool can contain.",
40+
"min": "Minimum number of physical database connections that this connection pool can contain."
41+
}
42+
}
4343
}

package.json

+53-36
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,55 @@
11
{
2-
"name": "node-red-contrib-postgresql",
3-
"version": "0.1.1",
4-
"scripts": {
5-
"test": "eslint postgresql.js"
6-
},
7-
"description": "Node-RED node for PostgreSQL, supporting parameters, split, back-pressure",
8-
"author": {
9-
"name": "Alexandre Alapetite",
10-
"url": "https://alexandra.dk/alexandre.alapetite"
11-
},
12-
"dependencies": {
13-
"mustache": "^4.2.0",
14-
"pg": "^8.6.0",
15-
"pg-cursor": "^2.6.0"
16-
},
17-
"license": "Apache-2.0",
18-
"repository": {
19-
"type": "git",
20-
"url": "https://github.com/alexandrainst/node-red-contrib-postgresql"
21-
},
22-
"keywords": [
23-
"backpressure",
24-
"node-red-contrib",
25-
"node-red",
26-
"nodered",
27-
"postgres",
28-
"postgresql"
29-
],
30-
"node-red": {
31-
"nodes": {
32-
"postgresql": "postgresql.js"
33-
}
34-
},
35-
"devDependencies": {
36-
"eslint": "^7.31.0"
37-
}
2+
"name": "node-red-contrib-postgresql",
3+
"version": "0.1.1",
4+
"scripts": {
5+
"test": "eslint postgresql.js"
6+
},
7+
"description": "Node-RED node for PostgreSQL, supporting parameters, split, back-pressure",
8+
"author": {
9+
"name": "Alexandre Alapetite",
10+
"url": "https://github.com/Alkarex"
11+
},
12+
"contributors": [
13+
{
14+
"name": "Andrea Batazzi",
15+
"email": "[email protected]",
16+
"url": "https://github.com/andreabat"
17+
},
18+
{
19+
"name": "Yeray Medina López",
20+
"email": "[email protected]",
21+
"url": "https://github.com/ymedlop"
22+
},
23+
{
24+
"name": "Hamza Jalouaja",
25+
"email": "[email protected]",
26+
"url": "https://github.com/HySoaKa"
27+
}
28+
],
29+
"dependencies": {
30+
"mustache": "^4.2.0",
31+
"pg": "^8.6.0",
32+
"pg-cursor": "^2.6.0"
33+
},
34+
"license": "Apache-2.0",
35+
"repository": {
36+
"type": "git",
37+
"url": "https://github.com/alexandrainst/node-red-contrib-postgresql"
38+
},
39+
"keywords": [
40+
"backpressure",
41+
"node-red-contrib",
42+
"node-red",
43+
"nodered",
44+
"postgres",
45+
"postgresql"
46+
],
47+
"node-red": {
48+
"nodes": {
49+
"postgresql": "postgresql.js"
50+
}
51+
},
52+
"devDependencies": {
53+
"eslint": "^7.31.0"
54+
}
3855
}

0 commit comments

Comments
 (0)