1.0.17 • Published 3 years ago

hi-mysql v1.0.17

Weekly downloads
83
License
MIT
Repository
github
Last release
3 years ago

hi-mysql

import x from './index';
const master = {
  host: "192.168.99.100",
  port: 3306,
  user: "root",
  password: "***",
  database: "test"
};
const slave1 = {
  host: "192.168.99.101",
  port: 3306,
  user : "developer",
  password: "***",
  database: "test"
}

const options = [master, slave];

// single instance
const pool = x.createPool(master);

// multiple instance, the first argument is master node
const pool = x.createPool([master, slave1, ... slaveN]);

const rows = await pool.query('select * from t');
const row = await pool.queryObject('select * from t limit 1');
const autoIncrementId = await pool.executeInsert('insert into t set name = ?, val = ?', ['a', 1]);
const affectedRows = await pool.executeUpdate('update t set val = 2');
const masterConn = pool.getConnection('master');
const slaveConn = pool.getConnection('slave');
1.0.17

3 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

6 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago