Function
createMySQLPool
({
host,
port,
user,
password,
database,
multipleStatements,
queryTimeout,
}: MySQLConfig)
Source from the content-addressed store, hash-verified
| 139 | } |
| 140 | |
| 141 | async function createMySQLPool({ |
| 142 | host, |
| 143 | port, |
| 144 | user, |
| 145 | password, |
| 146 | database, |
| 147 | multipleStatements, |
| 148 | queryTimeout, |
| 149 | }: MySQLConfig): Promise<Pool> { |
| 150 | return mysqlPool( |
| 151 | mysql.createPool({ |
| 152 | host, |
| 153 | port, |
| 154 | user, |
| 155 | password, |
| 156 | database, |
| 157 | multipleStatements, |
| 158 | typeCast(field, next) { |
| 159 | switch (field.type) { |
| 160 | case 'TIMESTAMP': |
| 161 | case 'DATE': |
| 162 | case 'DATETIME': |
| 163 | return field.string(); |
| 164 | default: |
| 165 | return next(); |
| 166 | } |
| 167 | }, |
| 168 | }), |
| 169 | queryTimeout |
| 170 | ); |
| 171 | } |
| 172 | |
| 173 | function mysqlPool(pool: mysql.Pool, queryTimeout: number): Pool { |
| 174 | return { |
Tested by
no test coverage detected