Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
active-query-builder
Advanced tools
Readme
Simple and flexible way to write your next MySQL queries.
Writing queries with mysql is difficult because it doesn't supports ES6 Promise and while working on a personal project I found that same queries are repeated over and over.
I have come up with a simple and flexible solution for writing repetitive queries using active query builder. This pattern allows information to be retrieved, inserted, and updated in your database with minimal scripting. In some cases only one or two lines of code are necessary to perform a database action.
This package is mainly designed for MySQL. It's written in JavaScript, does not require compiling, and is MIT licensed.
const ActiveQueryBuilder = require('active-query-builder')
// make connection to your database
const conn = new ActiveQueryBuilder({
host: 'localhost',
user: 'root',
password: 'root',
database: 'sandbox',
})
// query method
conn.query('SELECT * FROM person WHERE email=?', ['john@domain.com'])
.then(({results, fields, query}) => {
console.log(results) // this is your result
})
// get method
conn.get('users').then(({results, fields, query}) => {
console.log(results) // this is your result
})
// get_where method
conn.get_where('users', { 'email': 'john@domain.com' })
.then(({ results, fields, query }) => {
console.log(results) // this is your result
})
Things you need to install the package
A step by step series of examples that tell you how to get a development env running
Say what the step will be
npm install mysql active-query-builder --save
Tests gives us confidence, hence we have written tests for each method. Before creating pull request make sure that you have passed all tests
npm run test
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
Sagar Gavhane - core author
This project is licensed under the MIT License - see the LICENSE.md file for details
FAQs
Simple and flexible way to write your next MySQL queries.
The npm package active-query-builder receives a total of 42 weekly downloads. As such, active-query-builder popularity was classified as not popular.
We found that active-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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
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.