# @blued-core-oversea/mysql-client

> 基于 sequelize 的一层封装。

Latest version **1.0.0** (published 2024-12-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install @blued-core-oversea/mysql-client
pnpm add @blued-core-oversea/mysql-client
yarn add @blued-core-oversea/mysql-client
bun add @blued-core-oversea/mysql-client
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-12-13 |
| First published | 2021-08-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 25.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | bluediapp |

## Links

- npm: https://www.npmjs.com/package/@blued-core-oversea/mysql-client
- npm.io page: https://npm.io/package/@blued-core-oversea/mysql-client

## Dependencies (4)

- [mysql2](https://npm.io/package/mysql2.md) ^3.11.5
- [sequelize](https://npm.io/package/sequelize.md) ^6.37.5
- [node-qconf](https://npm.io/package/node-qconf.md) ^0.4.2
- [sequelize-typescript](https://npm.io/package/sequelize-typescript.md) ^2.1.6

## Recent versions

- 1.0.0 (latest) — 2024-12-13
- 0.1.1 — 2022-11-11
- 0.1.0 — 2022-11-08
- 0.0.9 — 2021-12-09
- 0.0.8 — 2021-12-09
- 0.0.7 — 2021-12-08
- 0.0.6 — 2021-11-30
- 0.0.5 — 2021-08-16
- 0.0.4 — 2021-08-16
- 0.0.3 — 2021-08-14
- 0.0.2 — 2021-08-13
- 0.0.1 — 2021-08-13

## README

基于 sequelize 的一层封装。

```bash
npm i @blued-core-oversea/mysql-client
```

```typescript
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)
})
```

---
_Source: https://npm.io/package/@blued-core-oversea/mysql-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
