Skip to main content
Module

x/windmill/mysql.ts>mysqlClient

Windmill deno client (separated from the main repo because most of the code is auto-generated from the openapi and not worth committing)
Go to Latest
function mysqlClient
import { mysqlClient } from "https://deno.land/x/windmill@v1.105.0/mysql.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

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