Skip to content

Commit 40f4295

Browse files
authored
feat: add mysql config pool parameter (#16)
1 parent 6964ee2 commit 40f4295

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/libs/MysqlBin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export class MysqlBin {
1010
constructor(config: CoaMysql.Config) {
1111
// 创建数据库连接
1212
const mysql_env_main = config.databases.main || CoaError.throw('MysqlBin.ConfigMissing', '缺少主数据库配置')
13-
const { host, port, user, password, charset, debug } = config
13+
const { host, port, user, password, charset, debug, pool } = config
1414
const database = mysql_env_main.database
1515

1616
// 数据库连接
17-
const io = Knex({ client: 'mysql', connection: { host, port, user, password, database, charset, debug } })
17+
const io = Knex({ client: 'mysql', connection: { host, port, user, password, database, charset, debug }, pool })
1818

1919
io.on('query-error', (error: any) => {
2020
echo.error(error)

src/typings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ export namespace CoaMysql {
3939
}
4040
debug: boolean
4141
trace: boolean
42+
pool?: { min: number; max: number }
4243
}
4344
}

0 commit comments

Comments
 (0)