Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
sl-mysql-query-builder
Advanced tools
Readme
simple javascirpt query maker for mysql.
support for complex condition of query.
npm install sl-mysql-query-builder
const MySQLQueryBuilder = require('sl-mysql-query-builder');
const builder = new MySQLQueryBuilder();
const condition = {
'user_id': '123'
}
let build = builder.table('MyTable').read().where(condition).order('meeting_date', 'DESC').paginate(3, 4).build();
console.log(build);
/*
Equal to
SELECT * FROM MyTable WHERE user_id = '123' ORDER BY meeting_date DESC LIMIT 3, 4;
*/
and will update more...
const condition = {
'meeting_date': {
expression: '(:from_date <= meeting_date AND meeting_date <= :to_date)',
value: {
":from_date": 8,
":to_date": 9
}
}
};
const obj = {
'creation_date': new Date().getTime(),
'user_id': '1234'
};
let history = {
expression: `\`history\` = JSON_ARRAY_APPEND(history, "$", '${JSON.stringify(obj)}')`,
value: {}
}
obj.history = history;
let build = builder9.table('SalesLogs').update(obj).where({'log_id': '6dc314af38c9be471f98a6044d6dc073'}).build();
let obj = {
'show_count': {
'expression': 'show_count = show_count + 1',
'value': {}
}
};
let build = builder11.table('Board').update(obj).where({}).build();
let build = builder10.procedure('UpdateLogHistory', '123').build();
console.log(build);
const dateTime = new Date().getTime();
let obj = {
'log_id': ['a', 'b'],
'user_id': ['1', '2'],
'creation_date': [dateTime, dateTime]
};
let build = builder13.table('SalesLogs').insert(obj, true).build();
let userId ='123';
let build = builder7.table('UsersTree').read().where({'UsersTree.user_id': userId}).join('Users', {'Users.user_id': userId}).build();
In this case, user_id
condition converts to user_id = '123' OR user_id = '456'
(OR is default, you can change it to AND)
const condition = {
'user_id': ['123', '456'],
'meeting_date': {
expression: '(:from_date <= meeting_date AND meeting_date <= :to_date)',
value: {
":from_date": 8,
":to_date": 9
}
}
};
let build = builder4.table('SalesLogs').read().where(condition).order('meeting_date', 'DESC').paginate(3, 4).build();
run test with mocha
mocha test/query_builder.test.js
FAQs
simple mysql query maker
The npm package sl-mysql-query-builder receives a total of 0 weekly downloads. As such, sl-mysql-query-builder popularity was classified as not popular.
We found that sl-mysql-query-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.