Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created June 12, 2020 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/d4bb3715419d7582546c4d9975b30427 to your computer and use it in GitHub Desktop.
Save uno-de-piera/d4bb3715419d7582546c4d9975b30427 to your computer and use it in GitHub Desktop.
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