sidorares / sidorares/node-mysql2
conn is not defined in Example 2 on Promise-Wrapper.md
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 680
- Avg merge
- 9h 7m
- Merged PRs (30d)
- 59
Description
async function example1 () {
const mysql = require('mysql2/promise');
const conn = await mysql.createConnection({ database: test });
const [rows, fields] = await conn.execute('select ?+? as sum', [2, 2]);
}
async function example2 () {
const mysql = require('mysql2/promise');
const pool = mysql.createPool({database: test});
// execute in parallel, next console.log in 3 seconds
await Promise.all([pool.query('select sleep(2)'), pool.query('select sleep(3)')]);
console.log('3 seconds after');
await pool.end();
await conn.end();
}
From where does conn in example 2, if it has not been defined?
Example 2 would not be wrong?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open Promise-Wrapper.md and inspect Example 2 alongside Example 1, focusing on the cleanup calls and the variables defined in that example. Done when the example no longer references an undefined connection and the documented pool-based parallel queries remain accurate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mysql, node.js
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100