import { mysqlClient } from "https://deno.land/x/windmill@v1.67.0/mod.ts";
Establish MySQL connection using MySQL client for Deno: https://deno.land/x/mysql2@v1.0.6/mod.ts
IMPORTANT: make sure to close the connection with .end()
Examples
Example 1
Example 1
const conn = await mysqlClient(db);
await conn.execute('CREATE TABLE IF NOT EXISTS pets (name varchar(255), kind varchar(255))');
await conn.execute('INSERT INTO pets VALUES (?, ?)', ['behemot','cat']);
const [rows] = await conn.execute('SELECT * from pets');
conn.end();
console.log(rows);
Parameters
db: Resource<"mysql">
the MySQL resource to establish the connection for