2.0.1 • Published 5 years ago

@blued-core/mysql-client v2.0.1

Weekly downloads
14
License
ISC
Repository
-
Last release
5 years ago

基于 mysql2 和 sequelize 的一层封装。

npm i @blued-core/mysql-client

API与 Sequelize 保持一致,内置定时更新 Client 之类的功能。

使用方式:

cache 与 mysql-conf 组件都为可选的,可以自己根据描述自定义

import Cache from '@blued-core/cache'
import { MysqlConf } from '@blued-core/mysql-conf'
import MysqlClient, { QueryTypes } from '@blued-core/mysql-client'

const mysqlConf = new MysqlConf({
  mysql1: {
    qconf: 'XXX',
    database: 'XX database'
  }
})

async function main () {
  // 如不想安装 Cache ,则可使用 new Map() 代替
  const mysqlClient = new MysqlClient(mysqlConf, new Cache())

  const mysql = mysqlClient.getClient('mysql1')

  const results = await mysql.query(
    `SELECT col1, col2 FROM table LIMIT 10;`,
    { type: QueryTypes.SELECT }
  )
}

main()
2.0.1

5 years ago

2.0.0

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.2.0

5 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.21

6 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago