Gathering detailed insights and metrics for sql-easy
Gathering detailed insights and metrics for sql-easy
Gathering detailed insights and metrics for sql-easy
Gathering detailed insights and metrics for sql-easy
Promise syntax sugar for mysql.js. Simple grammar rules and await async are also available.
npm install sql-easy
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
6 Commits
1 Branches
1 Contributors
Updated on Oct 09, 2018
Latest Version
1.0.8
Package Id
sql-easy@1.0.8
Unpacked Size
9.46 kB
Size
3.53 kB
File Count
5
NPM Version
5.6.0
Node Version
8.11.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Promise syntax sugar for mysql.js. Simple grammar rules and await async are also available.
This is a npm module available through npm registry. Before installing, make sure you have installed Node.js 8.0 or higher. You can install it by npm install command:
npm install sql-easy
The module provide a more easy way for JavaScript developers to operate the mysql database. Here is an example on how to query all data from a table of mysql database:
const Sql = require('sql-easy');
let sl = new Sql({
host : 'localhost',
user : 'username',
password : 'password',
database : 'demo',
table : 'info'
})
const OperateObject = {};
sl.query(OperateObject).then(res => {
//get the query result here
console.log(res);
}).catch(err => {
//catch the error here
console.log(err);
})
It is easy to connect your mysql Database. Just create a sql-easy instance and pass a object as a configuation option. The option is as same as mysql.js's configuation option.
let sl = new Sql({
host : 'localhost',
user : 'username',
password : 'password',
database : 'demo',
table : 'info'
})
Query all data ot the table
sl.query().then(res => {
let result = res.data;
let status = res.status.
}).catch(err => {})
Query data with conditions in some fields
sl.query({
fields: ['id', 'title', 'date'],
conditions: `id>10 && name='kitty' || title='订阅号'`
}).then(res => {
cosole.log(res.data);
}).catch(err => {})
Query data of other tables
sl.query({
table: 'othertable'
}).then(res = {}).catch(err => {});
Insert data into database
sl.insert({
fields: ['id', 'title', 'name'],
data: [
[2, '标题', 'kitty'],
[52, '任务', 'peter'],
[10, '测试', 'marry']
]
}).then(res => {}).catch(err => {})
Update data with conditions in some fields
sl.update({
fields: ['id', 'title', 'name'],
data: ['2', '标题', 'kitty'],
conditions: `id>10 && name='kitty' || title='订阅号'`
}).then(res => {}).catch(err => {})
Delete some lines with conditions
sl.delete({
conditions: `id>10 && name='kitty' || title='订阅号'`
}).then(res => {}).catch(err => {})
Core of the sql-easy is the OperateObject. Here are all attributes of the Object.
Fields of the database you want to operate. It must be provided in Insert and Update operation. Follow is an example:
{
fields: ['name', 'id', 'title', 'date']
}
The data you want to Insert or Update.
Update one line data
{
data: ['kitty', '12', '问题研究所', '20180521']
}
Insert more line data
{
data: [
['kitty', '52', '网红爆款', '20140212'],
['kathy', '21', '命名空间', '20140212'],
['peter', '12', '暂时有空', '20140212'],
]
}
The conditions in WHERE case, it is not necessary in all operations. You can use it very easily because it is similar to javascript syntax.
{
conditions: `id>5 && name='kathy' || title='暂时有空'`
}
Tablename of the database you want to operate. It can cover you configuation option.
Most of work has been done by mysql.js. Thanks goes to the people who have contributed code to this module.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More