Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
67ff9f0d
Commit
67ff9f0d
authored
May 23, 2023
by
Kamron Aroonrua
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dt-pgsql
parent
39b02975
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
2 deletions
+116
-2
Changelog
Changelog
+2
-1
index.js
plugins/dt/dt-pgsql/index.js
+13
-0
package.json
plugins/dt/dt-pgsql/package.json
+14
-0
perform.js
plugins/dt/dt-pgsql/perform.js
+86
-0
version.json
version.json
+1
-1
No files found.
Changelog
View file @
67ff9f0d
# Changelog
# Changelog
## [1.2.6dev] - 2023-05-2
2
## [1.2.6dev] - 2023-05-2
3
### Added
### Added
- TRIGGER :: http trigger callback
- TRIGGER :: http trigger callback
- PLUGIN :: do-http-callback
- PLUGIN :: do-http-callback
- PLUGIN :: dt-pgsql
### Removed
### Removed
- PLUGIN :: di-gistda-air
- PLUGIN :: di-gistda-air
- PLUGIN :: di-tanpibut
- PLUGIN :: di-tanpibut
...
...
plugins/dt/dt-pgsql/index.js
0 → 100644
View file @
67ff9f0d
var
util
=
require
(
'util'
);
var
DTPlugin
=
require
(
'../dt-plugin'
);
function
DTTask
(
context
,
request
){
DTPlugin
.
call
(
this
,
context
,
request
);
this
.
name
=
"pgsql"
;
this
.
output_type
=
""
;
}
util
.
inherits
(
DTTask
,
DTPlugin
);
DTTask
.
prototype
.
perform
=
require
(
'./perform'
);
module
.
exports
=
DTTask
;
plugins/dt/dt-pgsql/package.json
0 → 100644
View file @
67ff9f0d
{
"name"
:
"dt-pgsql"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"pg"
:
"^8.5.1"
}
}
plugins/dt/dt-pgsql/perform.js
0 → 100644
View file @
67ff9f0d
var
pg
=
require
(
'pg'
);
var
ctx
=
require
(
'../../../context'
);
var
Utils
=
ctx
.
getLib
(
'lib/util/plugin-utils'
);
function
perform_function
(
context
,
request
,
response
){
var
job_id
=
context
.
jobconfig
.
job_id
;
var
transaction_id
=
context
.
transaction
.
id
;
var
param
=
context
.
task
.
config
.
param
||
{};
var
memstore
=
context
.
task
.
memstore
var
output_type
=
request
.
input_type
;
var
data
=
request
.
data
;
var
meta
=
request
.
meta
||
{};
var
req_host
=
param
.
host
||
"localhost"
;
var
req_port
=
param
.
port
||
"3306"
var
req_user
=
param
.
user
||
""
;
var
req_pass
=
param
.
password
||
""
;
var
req_db
=
param
.
database
||
""
;
var
req_sql
=
param
.
sql
||
""
;
var
env
=
{
'type'
:
output_type
,
'data'
:
data
,
'meta'
:
meta
}
if
(
typeof
data
==
'string'
&&
req_sql
==
""
){
req_sql
=
"${data}"
}
req_sql
=
Utils
.
vm_execute_text
(
env
,
req_sql
);
//parsing param from meta
if
(
typeof
meta
.
_param
==
'object'
)
{
var
_prm
=
meta
.
_param
;
req_host
=
(
_prm
.
host
)?
_prm
.
host
:
req_host
;
req_port
=
(
_prm
.
port
)?
_prm
.
host
:
req_port
;
req_user
=
(
_prm
.
user
)?
_prm
.
user
:
req_user
;
req_pass
=
(
_prm
.
password
)?
_prm
.
password
:
req_pass
;
req_db
=
(
_prm
.
database
)?
_prm
.
database
:
req_db
;
req_sql
=
(
_prm
.
sql
)?
_prm
.
sql
:
req_sql
;
}
var
conf
=
{
"host"
:
req_host
,
"port"
:
Number
(
req_port
),
"user"
:
req_user
,
"password"
:
req_pass
,
"database"
:
req_db
}
response
.
meta
=
meta
;
pgexcute
(
conf
,
req_sql
,
function
(
err
,
result
){
if
(
!
err
){
response
.
success
(
result
,
output_type
);
}
else
{
response
.
error
(
"pgsql error"
);
}
});
}
function
pgexcute
(
conf
,
sql
,
callback
){
var
client
=
new
pg
.
Client
(
conf
);
client
.
connect
(
function
(
err
)
{
if
(
err
)
{
callback
(
err
);
return
console
.
error
(
'could not connect to postgres'
,
err
);
}
client
.
query
(
sql
,
function
(
err
,
result
)
{
if
(
err
)
{
callback
(
err
);
client
.
end
();
return
console
.
error
(
'error running query'
,
err
);
}
callback
(
null
,
result
);
client
.
end
();
});
});
}
module
.
exports
=
perform_function
;
version.json
View file @
67ff9f0d
{
{
"version"
:
"1.2.6dev"
,
"version"
:
"1.2.6dev"
,
"build"
:
"2023052
216
00"
"build"
:
"2023052
322
00"
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment