Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created Jun 12, 2020
Embed
What would you like to do?
import {Client} from "https://deno.land/x/mysql/mod.ts";
import "https://deno.land/x/dotenv/load.ts";
export class Database {
client: Client;
constructor() {
this.client = new Client();
this.client.connect({
hostname: Deno.env.get('DATABASE_HOST'),
db: Deno.env.get('DATABASE_NAME'),
username: Deno.env.get('DATABASE_USER'),
password: Deno.env.get('DATABASE_PASSWORD'),
});
}
async query(sql: string) {
return await this.client.query(sql);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment