2.0.1 • Published 4 years ago

@blued-core/mysql-client v2.0.1

Weekly downloads
14
License
ISC
Repository
-
Last release
4 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

4 years ago

2.0.0

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago