Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nodejs-yitong-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Metrics
Environments
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
yitong-public
nodejs-yitong-sdk
Commits
10c131bf
Commit
10c131bf
authored
Jan 21, 2022
by
孙傲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加数据库网关sdk
parent
bb0b8bc6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
2 deletions
+66
-2
dbms.js
dbms.js
+64
-0
package.json
package.json
+2
-2
No files found.
dbms.js
0 → 100644
View file @
10c131bf
/**
* 数据库网关服务
*/
const
axios
=
require
(
'
axios
'
);
class
DatabaseManagementSystem
{
constructor
(
options
)
{
this
.
options
=
Object
.
assign
({
user
:
"
default
"
,
password
:
""
,
timeout
:
3
*
60
*
1000
,
// 3 min
enable_http_compression
:
0
,
date_time_output_format
:
"
simple
"
,
output_format_json_quote_64bit_integers
:
1
,
named_parameter_format
:
"
jdbc
"
},
options
);
this
.
http
=
axios
.
create
({
method
:
"
POST
"
,
baseURL
:
this
.
options
.
url
,
params
:
{
enable_http_compression
:
this
.
options
.
enable_http_compression
,
date_time_output_format
:
this
.
options
.
date_time_output_format
,
output_format_json_quote_64bit_integers
:
this
.
options
.
output_format_json_quote_64bit_integers
,
named_parameter_format
:
this
.
options
.
named_parameter_format
},
headers
:
{
"
Accept-Encoding
"
:
"
gzip
"
,
"
X-ClickHouse-User
"
:
this
.
options
.
user
,
"
X-ClickHouse-Key
"
:
this
.
options
.
password
,
"
X-ClickHouse-Format
"
:
"
JSON
"
},
responseType
:
"
JSON
"
,
responseEncoding
:
"
utf8
"
,
timeout
:
this
.
options
.
timeout
});
}
async
query
(
database
,
query
,
queryParameters
)
{
let
{
data
:
{
data
}
}
=
await
this
.
http
({
url
:
""
,
params
:
{
database
:
database
,
params
:
queryParameters
?
JSON
.
stringify
(
queryParameters
)
:
null
},
data
:
query
});
return
data
;
}
async
predefinedQuery
(
database
,
query
,
queryParameters
)
{
let
{
data
:
{
data
}
}
=
await
this
.
http
({
url
:
query
,
params
:
{
database
:
database
,
params
:
queryParameters
?
JSON
.
stringify
(
queryParameters
)
:
null
}
});
return
data
;
}
}
module
.
exports
=
{
DatabaseManagementSystem
}
\ No newline at end of file
package.json
View file @
10c131bf
{
"name"
:
"nodejs-yitong-sdk"
,
"version"
:
"1.0.
3
"
,
"version"
:
"1.0.
4
"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
...
...
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