
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
English | 简体中文
http://www.778878.net/docs/#/koa78-mysql78/
use for nodejs ts
project
npm i koa78-mysql78
import Mysql78 from "koa78-mysql78";
import UpInfo from "koa78-upinfo";
const config = {
host: "localhost",
port: 3306,
user: "root",
password: "your_password",
database: "your_database",
isLog: true,
isCount: true
};
const mysql78 = new Mysql78(config);
const upInfo = new UpInfo(null).getGuest();
// Execute query
const result = await mysql78.doGet("SELECT * FROM users WHERE id = ?", [1], upInfo);
// Execute update
const affectedRows = await mysql78.doM("UPDATE users SET name = ? WHERE id = ?", ["John", 1], upInfo);
// Execute insert
const insertId = await mysql78.doMAdd("INSERT INTO users (name, email) VALUES (?, ?)", ["Alice", "alice@example.com"], upInfo);
// Execute transaction
const transactionResult = await mysql78.doT(
["UPDATE users SET balance = balance - ? WHERE id = ?", "UPDATE users SET balance = balance + ? WHERE id = ?"],
[[100, 1], [100, 2]],
["Transfer out failed", "Transfer in failed"],
"Transfer operation",
[100, 1, 2],
upInfo
);
// Set custom warning handler
mysql78.setWarnHandler(async (info, kind, up) => {
console.log(`Custom warning handler: ${kind} - ${info}`);
// Implement custom warning handling logic here
});
// Close connection pool
await mysql78.close();
getConnection()
to get a connection, remember to use releaseConnection()
to release the connection.isLog
and isCount
options affect performance, it is recommended to enable them only during debugging.doT
method instead of manually managing transactions.setWarnHandler
method to set custom warning handling logic for more flexible handling and recording of warning information.close()
method to close the connection pool and release resources.you can see test/
FAQs
nodejs koa78封装 上传类
The npm package mysql78 receives a total of 1 weekly downloads. As such, mysql78 popularity was classified as not popular.
We found that mysql78 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.