Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deno-client): support mysql #971

Merged
merged 1 commit into from
Dec 1, 2022
Merged

Conversation

mrl5
Copy link
Contributor

@mrl5 mrl5 commented Nov 30, 2022

I'm using https://deno.land/x/[email protected]/mod.ts only because https://deno.land/x/[email protected]/mod.ts has bug that I described in denodrivers/mysql#128 (comment)

hopefully this bug will be fixed soon, then I guess we can switch from https://github.com/sail-sail/mysql2 to https://github.com/denodrivers/mysql

tested locally with:

import { mysqlClient, mySql } from "./mysql.ts";

const db = {
    host: '0.0.0.0',
    port: 3306,
    user: 'root',
    password: 'change-me',
    database: 'test',
};

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 [r] = await conn.execute('SELECT * from pets');
conn.end();
console.log(r);

const kind = 'cat';
const { rows } = await mySql(db)`SELECT * from pets WHERE kind = ${kind}`;
console.log(rows);

@mrl5 mrl5 requested a review from rubenfiszel as a code owner November 30, 2022 23:28
@mrl5 mrl5 marked this pull request as draft December 1, 2022 00:02
@mrl5 mrl5 force-pushed the mysql branch 3 times, most recently from 7f5ef7e to 2acaf76 Compare December 1, 2022 22:35
@mrl5 mrl5 marked this pull request as ready for review December 1, 2022 22:35
@rubenfiszel rubenfiszel merged commit 0e402f6 into windmill-labs:main Dec 1, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants