0.1.1 • Published 1 year ago

@blued-core-oversea/mysql-client v0.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

基于 sequelize 的一层封装。

npm i @blued-core-oversea/mysql-client
import BattleRecord from './models/battle-record'

export const mysql = {
  liveArchive: {
    qconf: '/blued/backend/udb/live_archive',
    database: 'record_oversea',
    modelPath: path.resolve(__dirname, './models'),
  },
}

// 线上logging 参数建议设置为false
const client = new MysqlClient(mysql, {
  logging: true,
})

export const misOverseaMysqlClient = () => client.getClient('liveArchive')

const main = async () => {
  for (let i = 0; i <= 10; i++) {
    const pk = await BattleRecord.findOne({
      where: {
        pkId: '23423434342342342424',
      },
      raw: true,
    })

    console.log(pk)

    const result = await misOverseaMysqlClient().query(`SELECT pk_id AS pkId FROM battle_record WHERE pk_id = '23423434342342342424'`, {
      raw: true,
    })
    console.log((result))
  }
}

main().then(() => {
  console.log('success')
}).catch(error => {
  console.log(error)
})
0.1.0

2 years ago

0.1.1

1 year ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago