wangweianger / Mysqls
Licence: other
It is written in JavaScript,crud for mysql.You can also use transactions very easily.
Stars: ✭ 94
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Mysqls
Springboot Registration Login Theperfectexample
Login & Signup tutorial for every website ,mixes a lot of microservices together with the latest spring framework api in combined with full security
Stars: ✭ 89 (-5.32%)
Mutual labels: mysql
Qtl
A friendly and lightweight C++ database library for MySQL, PostgreSQL, SQLite and ODBC.
Stars: ✭ 92 (-2.13%)
Mutual labels: mysql
Incepiton Mysql
🍭A web platform designed for mysql inception
Stars: ✭ 90 (-4.26%)
Mutual labels: mysql
Scm Biz Suite
供应链中台系统基础版,集成零售管理, 电子商务, 供应链管理, 财务管理, 车队管理, 仓库管理, 人员管理, 产品管理, 订单管理, 会员管理, 连锁店管理, 加盟管理, 前端React/Ant Design, 后端Java Spring+自有开源框架,全面支持MySQL, PostgreSQL, 全面支持国产数据库南大通用GBase 8s,通过REST接口调用,前后端完全分离。
Stars: ✭ 1,310 (+1293.62%)
Mutual labels: mysql
Go Mygen
Quickly generate CURD and documentation for operating MYSQL.etc
Stars: ✭ 94 (+0%)
Mutual labels: mysql
Reactjs Spring Boot Crud Full Stack App
Learn how to develop a full-stack CRUD application using React as frontend and spring boot as backend.
Stars: ✭ 90 (-4.26%)
Mutual labels: mysql
Binlog Parser
A parser for MySQL binlog files that creates JSON messages. Useful for creating a stream of database events that can be stored and analyzed.
Stars: ✭ 93 (-1.06%)
Mutual labels: mysql
Dockerweb
A docker-powered bash script for shared web hosting management. The ultimate Docker LAMP/LEMP Stack.
Stars: ✭ 89 (-5.32%)
Mutual labels: mysql
Prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite & MongoDB (Preview)
Stars: ✭ 18,168 (+19227.66%)
Mutual labels: mysql
Freeacs
(Seeking maintainer) Free TR-069 ACS that can run (mostly) anywhere.
Stars: ✭ 90 (-4.26%)
Mutual labels: mysql
Docker Nginx Php Mysql
Docker running Nginx, PHP-FPM, MySQL & PHPMyAdmin
Stars: ✭ 1,322 (+1306.38%)
Mutual labels: mysql
Docker Compose Lamp
A basic LAMP stack environment built using Docker Compose.
Stars: ✭ 1,284 (+1265.96%)
Mutual labels: mysql
EN | CN
mysqls
It is written in JavaScript. crud for mysql. You can also use transactions very easily.
mysqls:A plug-in that generates SQL statements for node.js. call chaining .simple to use. support transaction.
- npm address:https://www.npmjs.com/package/mysqls
install:
npm install mysqls --save
or
yarn add mysqls
mysqls parameters
- init: sql Initialization
- exec: Executing SQL statements
- sql: Chain Call Generates SQL Statement
- transaction: transaction API
Use:
//import
import { init, exec, sql, transaction } from 'mysqls'
//require
let { init, exec, sql, transaction } = require('mysqls')
Config initialization:
// You can initialize the configuration at project startup
init({
host: 'localhost',
user: 'root',
password:'123456',
database: 'test',
port: 3306,
})
init configs
- ispool: Is it initialized as a connection pool. (default:true)
- host: host address. (default:'127.0.0.1')
- user: user. (default:'root')
- password: password. (default:'root')
- database: database. (default:'test')
- port: port. (default:'3306')
- waitConnection: wait for connections. (default:true)
- connectionLimit: connection limit. (default:10)
- queueLimit: queue limit. (default:0)
Only Generate SQL statements.
sql
.table('node_table')
.field('id,name')
.where({id:1})
.select()
// result
SELECT id,name FROM node_table WHERE id=1
use exec function
const sqlstr = sql
.table('node_table')
.field('id,name')
.where({id:1})
.select();
const result = await exec(sqlstr);
use sql.prototype.exec
const result = sql
.table('node_table')
.field('id,name')
.where({id:1})
.select(true)
.exec();
- .select(true):true
- It same to use at update(true)、insert(true)、delet(true)、query(true) method.
use Promise
// use exec function
exec(sql.table('web_pages').where({id:147}).select())
.then(res=>{
console.log(res)
}).catch(err=>{
console.log(err)
})
// use exec method
sql.table('web_pages').where({id:147}).select(true).exec()
.then(res=>{
console.log(res)
}).catch(err=>{
console.log(err)
})
使用async/await
// use exec function
const result = await exec(sql.table('web_pages').where({id:147}).select())
// use exec method
const result = await sql.table('web_pages').where({id:147}).select(true).exec()
transaction
const tranSqlArr = [
sql.table('table1').data({number:'number-5'}).update(true,true),
sql.table('table2').data({number:'number+5'}).update(true,true)
]
const result = await transaction(tranSqlArr)
Simple usage of generating SQL statements.
select
sql
.table('node_table')
.field('id,name')
.where({id:1})
.select()
SELECT id,name FROM node_table WHERE id=1
insert
sql
.table('node_table')
.data({name:'zane',email:'[email protected]'})
.insert()
INSERT INTO node_table (name,email) VALUES (`zane`,`[email protected]`)
batch insert
let data = [
{name:'zane',email:'[email protected]'},
{name:'zane_1',email:'[email protected]'},
{name:'zane_2',email:'[email protected]'},
]
sql
.table('node_table')
.data(data)
.insert()
INSERT INTO node_table (name,email) VALUES ('zane','[email protected]'),('zane_1','[email protected]'),('zane_2','[email protected]')
update
sql
.table('node_table')
.data({name:'zane',email:'[email protected]'})
.where({id:1})
.update()
UPDATE node_table SET name=`zane`,email=`[email protected]`
delet
sql .table('node_table')
.where({name:'zane'})
.delet();
DELETE FROM node_table WHERE name=`zane`
Advanced Usage.
// parameter json
sql
.table('node_table')
.where({id:1,name:'zane'})
.select()
SELECT * FROM node_table WHERE id=1 AND name=`zane`
// parameter array
let data=[
{id:1,name:'zhangsan',_type:'or'},
{sex:1,number:3}
]
sql.table('node_table').where(data).select()
SELECT * FROM node_table WHERE (id=1 OR name=`zhangsan` ) AND (sex=1 AND number=3 )
// multiple fields
let data=[
{id:1,name:'zhangsan',_type:'or',_nexttype:'or'},
{sex:1,number:3,_type:'and'}
]
sql.table('node_table').where(data).select()
SELECT * FROM node_table WHERE (id=1 OR name=`zhangsan`) OR (sex=1 AND number=3)
// Expression Query
let data={
id:{eq:100,egt:10,_type:'or'},
name:'zhangshan'
}
sql.table('node_table').where(data).select()
SELECT * FROM node_table WHERE ((id=100) OR (id>=10)) AND name=`zhangshan`
// Multiple queries
let data=[{
id:{eq:100,egt:10,_type:'or'},
name:'zhangshan',
_nexttype:'or'
},{
status:1,
name:{like:'%zane%'}
}]
sql.table('node_table').where(data).select()
SELECT * FROM node_table WHERE (((id=100) OR (id>=10)) AND name=`zhangshan`) OR (status=1 AND ((name LIKE `%zane%`)))
//UNION , UNION ALL
sql
.union('SELECT * FROM think_user_1',true)
.union('SELECT * FROM think_user_2',true)
.union(['SELECT * FROM think_user_3','SELECT name FROM think_user_4'])
.union('SELECT * FROM think_user_5',true)
.select()
result
(SELECT * FROM think_user_1) UNION ALL
(SELECT * FROM think_user_2) UNION ALL
(SELECT * FROM think_user_3) UNION
(SELECT name FROM think_user_4) UNION
(SELECT * FROM think_user_5)
Directory
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].