Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
mjs-mysql-builder
Advanced tools
import DB from 'mysql-builder'
DB.query(queryString, params) // -> Promise<Array<RowType>> - all rows
DB.queryRow(queryString, params) // -> Promise<?RowType> - first row
import { FieldBuilder } from 'mysql-builder';
const field = (new FieldBuilder('id')) // -> FieldBuilder
.type('int(11)') // -> FieldBuilder
.increment() // -> FieldBuilder
.notNull() // -> FieldBuilder
.primary() // -> FieldBuilder
.get() // -> string
`id` int(11) AUTO_INCREMENT NOT NULL,
PRIMARY KEY (`id`)
import { SchemaBuilder } from 'mysql-builder';
const schema = (new SchemaBuilder('users'))
.add('id', f => f.type('int(11)').increment().notNull().primary())
.add('email', f => f.type('varchar(50)').notNull().unique())
.add('name', f => f.type('varchar(50)').nullable())
.add('type', f => f.type('varchar(30)').index().using(INDEX_TYPES.BTREE))
.add('book_id', f => f.type('int(11)').notNull().foreign().references('books', 'id').onDelete(REFERENCE_OPTIONS.CASCADE))
/* You can get Schema string */
.build() // -> string
/* Or Query to DataBase */
.create() // -> Promise<void>
import { QueryBuilder } from 'mysql-builder'
const q = (new QueryBuilder('users'))
.select('name')
.aggregate(AGGREGATION.SUM, 'age', 'age')
.where({ name: 'bob' })
.groupBy('name')
.having('SUM(age) > 100')
.sortBy('age', DOWN)
/* You can get query string */
.build() // -> string
/* Or Query to DataBase */
.get() // -> Promise<Array<DBRow>>
SELECT `name`, SUM(`age`) age FROM `users`
WHERE `name`=`bob`
GROUP BY `name`
HAVING SUM(age) > 100
ORDER BY `age` DESC
import { Table } from 'mysql-builder';
const table = new Table('users');
type RowType = {[string]: any};
type ConditionType = number | RowType;
/* all supported methods */
table.insert(params: RowType) // -> Promise<void>
table.update(id: ConditionType, params: RowType) // -> Promise<void>
table.delete(id: ConditionType) // -> Promise<void>
table.set(id: ConditionType, field: string, value: any) // -> Promise<void>
table.find(id: ConditionType) // -> Promise<?RowType>
table.all() // -> Promise<Array<RowType>>
table.first() // -> Promise<{[string]: any}>
table.last() // -> Promise<{[string]: any}>
FAQs
Mysql query builder
The npm package mjs-mysql-builder receives a total of 1 weekly downloads. As such, mjs-mysql-builder popularity was classified as not popular.
We found that mjs-mysql-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
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.